From mboxrd@z Thu Jan 1 00:00:00 1970 From: SF Markus Elfring Date: Sun, 17 Sep 2017 13:34:22 +0000 Subject: [PATCH 3/4] [media] cpia2: Delete unnecessary null pointer checks in free_sbufs() Message-Id: List-Id: References: In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 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 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; } } -- 2.14.1 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: 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 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 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 8bit Sender: linux-media-owner@vger.kernel.org List-ID: 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; } } -- 2.14.1