From patchwork Wed Feb 4 18:56:51 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: 5779201 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 836AF9F2ED for ; Wed, 4 Feb 2015 18:57:26 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BD2DF200DB for ; Wed, 4 Feb 2015 18:57:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id ED246200B4 for ; Wed, 4 Feb 2015 18:57:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1161701AbbBDS46 (ORCPT ); Wed, 4 Feb 2015 13:56:58 -0500 Received: from mout.web.de ([212.227.15.4]:57694 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1161480AbbBDS45 (ORCPT ); Wed, 4 Feb 2015 13:56:57 -0500 Received: from [192.168.1.2] ([92.228.139.27]) by smtp.web.de (mrweb003) with ESMTPSA (Nemesis) id 0MEVkf-1YPvg53Xz7-00FnPa; Wed, 04 Feb 2015 19:56:53 +0100 Message-ID: <54D26B73.1050804@users.sourceforge.net> Date: Wed, 04 Feb 2015 19:56:51 +0100 From: SF Markus Elfring User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: Kalle Valo , linux-wireless@vger.kernel.org, netdev@vger.kernel.org CC: LKML , kernel-janitors@vger.kernel.org, Julia Lawall Subject: [PATCH] orinoco: Delete an unnecessary check before the function call "kfree" 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> In-Reply-To: <5317A59D.4@users.sourceforge.net> X-Provags-ID: V03:K0:h6wGQZg9Tfu4a2ISOSKl8NGqZ7LVUADF6k72lmx0cBpDaqiW0JT soNVEYMCktL0nVD65LKaJxuh5QHsLnSl5bIyIDbjH5LDygPReXiun3Zy2Phbc9ftNCbI5ul BjXAMh638rGq4VHngFOOUs0jJ8lQwW95+eVQuhFnI3AU6xl9eRlZt6eXQN8cyHBxv8+8HJd Pa1LtHBNneRrdm/xcdI2g== X-UI-Out-Filterresults: notjunk:1; Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_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: Wed, 4 Feb 2015 19:53:11 +0100 The kfree() function tests whether its argument is NULL and then returns immediately. Thus the test around the call is not needed. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring --- drivers/net/wireless/orinoco/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/orinoco/main.c b/drivers/net/wireless/orinoco/main.c index 38ec8d1..c410180 100644 --- a/drivers/net/wireless/orinoco/main.c +++ b/drivers/net/wireless/orinoco/main.c @@ -2342,7 +2342,7 @@ void free_orinocodev(struct orinoco_private *priv) list_for_each_entry_safe(sd, sdtemp, &priv->scan_list, list) { list_del(&sd->list); - if ((sd->len > 0) && sd->buf) + if (sd->len > 0) kfree(sd->buf); kfree(sd); }