Return-path: Received: from mout.web.de ([212.227.17.11]:57721 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753504AbbF0OgU (ORCPT ); Sat, 27 Jun 2015 10:36:20 -0400 Message-ID: <558EB4DE.3080406@users.sourceforge.net> (sfid-20150627_163644_117105_658C554B) Date: Sat, 27 Jun 2015 16:36:14 +0200 From: SF Markus Elfring MIME-Version: 1.0 To: Chris Park , Dean Lee , Greg Kroah-Hartman , Johnny Kim , Rachel Kim , linux-wireless@vger.kernel.org, devel@driverdev.osuosl.org CC: LKML , kernel-janitors@vger.kernel.org, Julia Lawall Subject: [PATCH 1/2] staging: wilc1000: Delete unnecessary checks before two function calls References: <5307CAA2.8060406@users.sourceforge.net> <530A086E.8010901@users.sourceforge.net> <530A72AA.3000601@users.sourceforge.net> <530B5FB6.6010207@users.sourceforge.net> <530C5E18.1020800@users.sourceforge.net> <530CD2C4.4050903@users.sourceforge.net> <530CF8FF.8080600@users.sourceforge.net> <530DD06F.4090703@users.sourceforge.net> <5317A59D.4@users.sourceforge.net> <558EB32E.6090003@users.sourceforge.net> In-Reply-To: <558EB32E.6090003@users.sourceforge.net> Content-Type: text/plain; charset=windows-1252 Sender: linux-wireless-owner@vger.kernel.org List-ID: From: Markus Elfring Date: Sat, 27 Jun 2015 15:56:57 +0200 The functions kfree() and release_firmware() test whether their argument is NULL and then return immediately. Thus the test around the calls is not needed. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring --- drivers/staging/wilc1000/linux_wlan.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index b352c50..2aa8d9b 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -2421,11 +2421,7 @@ int mac_ioctl(struct net_device *ndev, struct ifreq *req, int cmd) } done: - - if (buff != NULL) { - kfree(buff); - } - + kfree(buff); return s32Error; } @@ -2707,8 +2703,7 @@ static void __exit exit_wilc_driver(void) } } - - if ((g_linux_wlan != NULL) && g_linux_wlan->wilc_firmware != NULL) { + if (g_linux_wlan) { release_firmware(g_linux_wlan->wilc_firmware); g_linux_wlan->wilc_firmware = NULL; } -- 2.4.4