Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755273AbbF0OgX (ORCPT ); Sat, 27 Jun 2015 10:36:23 -0400 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> Date: Sat, 27 Jun 2015 16:36:14 +0200 From: SF Markus Elfring User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 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 Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K0:nJqbm3DQAj0B1sQNOiB+pGto/iVHcODcwQQYMbaSc+inpkssJJ3 SEvk+mwuIh/A6nA+T8gxV/xaI9chV4DdXbmh60ylOCOn+P/YqLIULNh8sYFoBRRmLn1mrGc EFpUu2nENeRZa3AHth2Uraxmp0cSMr4Jc97OP146KYxU4UPEhp6JaCZ/t5XPTCqz97SRwZx ySiGdO8N8rzGr0LGGzsrA== X-UI-Out-Filterresults: notjunk:1;V01:K0:MITJwKCWCG8=:LrtncpMyexGs/2+vlIxmS0 b0sTXiCbmO2twDKwqWlhSXiToNsETbby2Q+c9jfMTBxsrHuirZX1DozFh85oH9RydtX4bKuW0 5AWfPv1ytdd41CThKt+GqbB5MlA+iAVHXjPXa/kmbpLjlXPN8n92+MbS+FKgfIqPQkR2/Np/3 pUT84DtxZFisqX8udvIP/gPRrJewMKKHDi66ntaRP0uuH8XnqKac7+hGNj8INZSHNNMDNjZpC XBljUsQz9/etoITdxBVuE8Cy1BCbeG3uwmVZjZbWzKCSQjEnjJaATVcIew1d8t0CV/KvcPyLJ W12JLFLCntsVxAjIWoRzgQYhb3fjftvyMZWd6lvMCY1SEzjrozbMEj9SNYnT4ITOoIkt/rECm xPCB1qmHOuPqwHF5+TbvlrEe9e0Hc8Ab0HLn1ODlntXy5shYYxhDNZmGzElxL3S+aCc3/NQVz 7VgQdsSxDSRTs2V50HMTkqatnmM3jttX3Cq0OVdj3bGXhfE92aiFCEHOfgmNuaTsHvTm/nlew weOed4sTXkG7AUePrOK0h3M2iLvMUfqs4nqdskoVWdlBzcZxwP/53TRIVBnWa7krxEwL2TCdx DLYPmPfQ0oYEsA7Tq91K2lcefIIKHYvrBh4wkMMJNVrL7QuZo3HiXTH4Z/Z0V7NUa+60Hc2YM l1YuOeCbQC27tw4HK7ejhz9X1i2tg3USDfBC+w1zdWKVFB6QC50P7yhUdH8K6O2KezXk= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1393 Lines: 49 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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/