From patchwork Sat Jun 27 14:36:14 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SF Markus Elfring X-Patchwork-Id: 6685051 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id A2E16C05AC for ; Sat, 27 Jun 2015 14:36:42 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C8F0E2076B for ; Sat, 27 Jun 2015 14:36:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 03D1120767 for ; Sat, 27 Jun 2015 14:36:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753643AbbF0OgX (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 Received: from [192.168.1.2] ([77.182.50.16]) by smtp.web.de (mrweb102) with ESMTPSA (Nemesis) id 0Lu4q2-1YyIlz0HyQ-011VVr; Sat, 27 Jun 2015 16:36:17 +0200 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> 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-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-8.3 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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; }