From patchwork Wed Feb 4 19:10:33 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: 5779231 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 6E7549F30C for ; Wed, 4 Feb 2015 19:11:06 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A8DAD202FE for ; Wed, 4 Feb 2015 19:11:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6DB20202FF for ; Wed, 4 Feb 2015 19:11:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1161537AbbBDTKo (ORCPT ); Wed, 4 Feb 2015 14:10:44 -0500 Received: from mout.web.de ([212.227.17.11]:49771 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1161186AbbBDTKn (ORCPT ); Wed, 4 Feb 2015 14:10:43 -0500 Received: from [192.168.1.2] ([92.228.139.27]) by smtp.web.de (mrweb103) with ESMTPSA (Nemesis) id 0MDgDS-1YQCc10gEo-00H4GV; Wed, 04 Feb 2015 20:10:35 +0100 Message-ID: <54D26EA9.6020301@users.sourceforge.net> Date: Wed, 04 Feb 2015 20:10:33 +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: Jouni Malinen , Kalle Valo , linux-wireless@vger.kernel.org, netdev@vger.kernel.org CC: LKML , kernel-janitors@vger.kernel.org, Julia Lawall Subject: [PATCH] HostAP: 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:cuWn3Maye9TVY3sU1T9uLRNPdZ5b5d1OvLShsF6fAiibLY4ya3W N4dZPZIGzu6RLqzUzE+PtuqOenUDqZyPlVidIGgRVrU1Fvxa/syjRSQvoFl7cwpJ7eWiDjA ViZSO9epZY18F5AxlDr+Ywkfu11/2jBT80ZjcD9xIuIBUbytkyDLhvg+1eT1FNVzqspAEgv /WudDJ3AdZTABp66JEjMg== 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 20:06:39 +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/hostap/hostap_ap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/hostap/hostap_ap.c b/drivers/net/wireless/hostap/hostap_ap.c index 5965255..fd8d83d 100644 --- a/drivers/net/wireless/hostap/hostap_ap.c +++ b/drivers/net/wireless/hostap/hostap_ap.c @@ -145,7 +145,7 @@ static void ap_free_sta(struct ap_data *ap, struct sta_info *sta) if (sta->aid > 0) ap->sta_aid[sta->aid - 1] = NULL; - if (!sta->ap && sta->u.sta.challenge) + if (!sta->ap) kfree(sta->u.sta.challenge); del_timer_sync(&sta->timer); #endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */