From patchwork Sun Sep 17 13:34:22 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SF Markus Elfring X-Patchwork-Id: 9954821 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B77BF603F2 for ; Sun, 17 Sep 2017 13:35:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AD65228881 for ; Sun, 17 Sep 2017 13:35:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A10C428974; Sun, 17 Sep 2017 13:35:55 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8A8E5288F4 for ; Sun, 17 Sep 2017 13:35:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751517AbdIQNeh (ORCPT ); Sun, 17 Sep 2017 09:34:37 -0400 Received: from mout.web.de ([217.72.192.78]:60893 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750995AbdIQNef (ORCPT ); Sun, 17 Sep 2017 09:34:35 -0400 Received: from [192.168.1.2] ([77.181.201.34]) by smtp.web.de (mrweb102 [213.165.67.124]) with ESMTPSA (Nemesis) id 0M40zO-1dbUpe1w7m-00rbyV; Sun, 17 Sep 2017 15:34:24 +0200 Subject: [PATCH 3/4] [media] cpia2: Delete unnecessary null pointer checks in free_sbufs() From: SF Markus Elfring To: linux-media@vger.kernel.org, Arvind Yadav , Hans Verkuil , Laurent Pinchart , Mauro Carvalho Chehab , Sakari Ailus , Shyam Saini Cc: LKML , kernel-janitors@vger.kernel.org References: Message-ID: Date: Sun, 17 Sep 2017 15:34:22 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-GB X-Provags-ID: V03:K0:0b2aUIXp7GdAMpiyzF2cWQLdKex+/ag6SJHjw42qTIhw659Gmeq qpWy8GwdEBC+79SlbXjAiM7QQgkVEHYwx3bpC5QjoL4X8LNuH0aOxjOilflusMuEVXjAEC7 UWhvH9JMPoc2rlsGs03zFzXlEkO/gd1KAw55IpoaVLy4QUim6tDNF1EXmbI39+wokNQBAVI wbGRrOHMgOadGfeW80ufw== X-UI-Out-Filterresults: notjunk:1; V01:K0:tiASAaQdplY=:Bi8roQlzXVBxAxbanuSCCX cEgzeY0AhGAbBuvXDfm4PPa+VSjr0QW/Nq47oFDyXq6zcxyj023jVqts+8VvzYqDi2e/bAG97 ajxbdA3+3SvAveQIaqX7vAmhdW5QGUdN8ZBPJCC7h6LiTACdkqV4uoBor7VEIYF5XiZm+0oR0 AlhBaCJ60CEbdxufCOq0O8wRDj4MHXn5HxW11JWP7EzeN73UVsJ+6YSPK6UYwO7jjNjaj2hgY uUdaIMijDj07D1JtWkItqeXfQScZQxqDx86pqo3FKReyjGmlK9bAbtGptjPNs1DhvXmaMTnCy eKRdNrrJxKzXHEQoN4l5dDy4wCa955p4lqzH3T0Eb3WqZ62QdPAdcJPHxNy0cwa7eChyPl6Ru gjnQtvK4TzPR5oTsgKl85s7gxn4K61U0Q9wiVSngWoemacw2Nqi/D3mtjy7SAECGaayz8Lsy9 7tewsE7rilhfPFLXjt7qe6z/jp01sqGOR6A93GslOi42rjmwZ31rEIwG1bCZ9mGbbGCRQ18Ue IWP/bFs4SXzoWvQTn8H2b9sHRy3x3oHShFrndQD2AGIXDw4jhEOT3BuEpygt1dBGZ/2bKxZYV 1NJzbWttG+Whr9caE86ChF3Q2z+sAynXXAIkafR9Y04K6BFTS4XZpnBoUbXoxIhcxXa8NpbTp eWJbWkLGeIXYgG5oMPeYvkxseyF+y5vofgN00t2z1FBNlo9SkqEffjzpfoVPB9ocI6boULK4I FMUajd0tjhlNSMLqT4Q1bJ1JmwC28poIN+eLads7t2bAHOC8YptddUq4MxPr7UsEjsy+PCvab F0XSy6eqR/Mu9RbD2ljGrHjX0+ZqQnjYh3zgixKoEnRAAe8V/Y= Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Markus Elfring Date: Sun, 17 Sep 2017 13:23:47 +0200 The script "checkpatch.pl" pointed information out like the following. WARNING: kfree(NULL) is safe and this check is probably not required Thus fix the affected source code place. Signed-off-by: Markus Elfring --- drivers/media/usb/cpia2/cpia2_usb.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/drivers/media/usb/cpia2/cpia2_usb.c b/drivers/media/usb/cpia2/cpia2_usb.c index 161c9b827f8e..d1750fa48aa8 100644 --- a/drivers/media/usb/cpia2/cpia2_usb.c +++ b/drivers/media/usb/cpia2/cpia2_usb.c @@ -519,15 +519,11 @@ static void free_sbufs(struct camera_data *cam) int i; for (i = 0; i < NUM_SBUF; i++) { - if(cam->sbuf[i].urb) { - usb_kill_urb(cam->sbuf[i].urb); - usb_free_urb(cam->sbuf[i].urb); - cam->sbuf[i].urb = NULL; - } - if(cam->sbuf[i].data) { - kfree(cam->sbuf[i].data); - cam->sbuf[i].data = NULL; - } + usb_kill_urb(cam->sbuf[i].urb); + usb_free_urb(cam->sbuf[i].urb); + cam->sbuf[i].urb = NULL; + kfree(cam->sbuf[i].data); + cam->sbuf[i].data = NULL; } }