Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp3030065ybb; Sun, 22 Mar 2020 13:35:03 -0700 (PDT) X-Google-Smtp-Source: ADFU+vutKoCmNdL0FiIBw6iTW0gDGd+Jkn0QqCG+lc6Htsnuom3aUOHvFz55c/z25bGTfeFAh9Qa X-Received: by 2002:aca:c390:: with SMTP id t138mr14167433oif.117.1584909303429; Sun, 22 Mar 2020 13:35:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584909303; cv=none; d=google.com; s=arc-20160816; b=wNxQsQqOWWaeAaG2nMV/vLtws3PbjR3dx8KoffVkOJXdf0tX8K6dNT/2/EULdgihH7 UbAo29umFWqpVD/OcXK0R1eTA2q9tajDMSsExJ6rMfK6MgBR4mFv6AjMwFlQrRSm14Q8 2jyrd9FIRA+pKB3otymj1T1k5Bnz1U5aaHP1uz0Pcrc/20/rcESoAZFYQm6+HaZuzZyx ayQoyHa4jsM4CwM61gCHlO6Fwd3E50obox+9Jjtk1O7lblwJrjvILbmBnAwZZhuGbebf ufHie74IYBeXjMD5cUuVlU7hWasB3GRVdELLM5mqomLccyoNy331EoT9caSYt2eh1cnn JLEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date; bh=a6BiCnkWVNLwaSHT/6zo9i0ulBH5cXC0YVtorGyimG4=; b=v0i0/e5fOyIfXyGWLJ//GrPS7aVMIotN1zdsww80NHODI8G0TwkXeMIeWzsSH1TqNC 46sqthQUngUv4g3+iUoN9alpQkiOirGNduUG2Awbn84UVZE0GABzAJGSCXsYZgXQGdVS JIZda7kp4g7Gvwnuk8QRA8B/7wZxObOi62YVObPQjqhluviMTRMKaFkH8qbcb8h4wihq +jRrRlYTenV00Yd7XUxld9B5MUbHIdoyuIXQxhf1O2cWQmpO6unZnngHPjFS7RDPXdHT 7gt85yTg18UbFK5+BUtBeH5DAWJA8fTTseICVAkKDAymJULyAg8DurVU8O/NFuUywBZ2 iQ4Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u207si6291530oia.176.2020.03.22.13.34.50; Sun, 22 Mar 2020 13:35:03 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726781AbgCVUcy (ORCPT + 99 others); Sun, 22 Mar 2020 16:32:54 -0400 Received: from mail3-relais-sop.national.inria.fr ([192.134.164.104]:55122 "EHLO mail3-relais-sop.national.inria.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726623AbgCVUcy (ORCPT ); Sun, 22 Mar 2020 16:32:54 -0400 X-IronPort-AV: E=Sophos;i="5.72,293,1580770800"; d="scan'208";a="343214285" Received: from abo-173-121-68.mrs.modulonet.fr (HELO hadrien) ([85.68.121.173]) by mail3-relais-sop.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 22 Mar 2020 21:32:31 +0100 Date: Sun, 22 Mar 2020 21:32:31 +0100 (CET) From: Julia Lawall X-X-Sender: jll@hadrien To: Simran Singhal cc: Greg Kroah-Hartman , devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, outreachy-kernel@googlegroups.com Subject: Re: [Outreachy kernel] [PATCH] staging: rtl8723bs: Remove comparisons to NULL in conditionals In-Reply-To: <20200322202214.GA9750@simran-Inspiron-5558> Message-ID: References: <20200322202214.GA9750@simran-Inspiron-5558> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 23 Mar 2020, Simran Singhal wrote: > Remove comparisons to NULL in conditionals in > drivers/staging/rtl8723bs/core/rtw_ap.c > Issues reported by checkpatch.pl as: > CHECK: Comparison to NULL could be written The patch also drops some parentheses that are completely unrelated to the change described here. These changes should not be done in this patch. There is no need to give the name of the file in the log message. One can see that directly in the patch. Likewise, it is not necessary to give the complete message from checkpatch. Saying that checkpatch identified the problem is good enough. A good commit log message should say what you have done and why. The message above is missing the "why" part. Why is it a good idea to remove the NULL comparisons, beyond that checkpatch said that it was something to check? julia > > Signed-off-by: Simran Singhal > --- > drivers/staging/rtl8723bs/core/rtw_ap.c | 30 ++++++++++++------------- > 1 file changed, 15 insertions(+), 15 deletions(-) > > diff --git a/drivers/staging/rtl8723bs/core/rtw_ap.c b/drivers/staging/rtl8723bs/core/rtw_ap.c > index a76e81330756..82b977c07205 100644 > --- a/drivers/staging/rtl8723bs/core/rtw_ap.c > +++ b/drivers/staging/rtl8723bs/core/rtw_ap.c > @@ -79,7 +79,7 @@ static void update_BCNTIM(struct adapter *padapter) > &tim_ielen, > pnetwork_mlmeext->IELength - _FIXED_IE_LENGTH_ > ); > - if (p != NULL && tim_ielen > 0) { > + if (p && tim_ielen > 0) { > tim_ielen += 2; > > premainder_ie = p + tim_ielen; > @@ -103,7 +103,7 @@ static void update_BCNTIM(struct adapter *padapter) > &tmp_len, > (pnetwork_mlmeext->IELength - _BEACON_IE_OFFSET_) > ); > - if (p != NULL) > + if (p) > offset += tmp_len + 2; > > /* get supported rates len */ > @@ -112,7 +112,7 @@ static void update_BCNTIM(struct adapter *padapter) > _SUPPORTEDRATES_IE_, &tmp_len, > (pnetwork_mlmeext->IELength - _BEACON_IE_OFFSET_) > ); > - if (p != NULL) > + if (p) > offset += tmp_len + 2; > > /* DS Parameter Set IE, len =3 */ > @@ -1036,7 +1036,7 @@ int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf, int len) > &ie_len, > (pbss_network->IELength - _BEACON_IE_OFFSET_) > ); > - if (p != NULL) { > + if (p) { > memcpy(supportRate, p + 2, ie_len); > supportRateNum = ie_len; > } > @@ -1048,7 +1048,7 @@ int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf, int len) > &ie_len, > pbss_network->IELength - _BEACON_IE_OFFSET_ > ); > - if (p != NULL) { > + if (p) { > memcpy(supportRate + supportRateNum, p + 2, ie_len); > supportRateNum += ie_len; > } > @@ -1136,8 +1136,8 @@ int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf, int len) > break; > } > > - if ((p == NULL) || (ie_len == 0)) > - break; > + if (!p || ie_len == 0) > + break; > } > > /* wmm */ > @@ -1165,7 +1165,7 @@ int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf, int len) > break; > } > > - if ((p == NULL) || (ie_len == 0)) > + if (!p || ie_len == 0) > break; > } > } > @@ -1296,7 +1296,7 @@ int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf, int len) > psta = rtw_get_stainfo(&padapter->stapriv, pbss_network->MacAddress); > if (!psta) { > psta = rtw_alloc_stainfo(&padapter->stapriv, pbss_network->MacAddress); > - if (psta == NULL) > + if (!psta) > return _FAIL; > } > > @@ -1453,7 +1453,7 @@ u8 rtw_ap_set_pairwise_key(struct adapter *padapter, struct sta_info *psta) > } > > psetstakey_para = rtw_zmalloc(sizeof(struct set_stakey_parm)); > - if (psetstakey_para == NULL) { > + if (!psetstakey_para) { > kfree(ph2c); > res = _FAIL; > goto exit; > @@ -1491,12 +1491,12 @@ static int rtw_ap_set_key( > /* DBG_871X("%s\n", __func__); */ > > pcmd = rtw_zmalloc(sizeof(struct cmd_obj)); > - if (pcmd == NULL) { > + if (!pcmd) { > res = _FAIL; > goto exit; > } > psetkeyparm = rtw_zmalloc(sizeof(struct setkey_parm)); > - if (psetkeyparm == NULL) { > + if (!psetkeyparm) { > kfree(pcmd); > res = _FAIL; > goto exit; > @@ -1668,11 +1668,11 @@ static void update_bcn_wps_ie(struct adapter *padapter) > &wps_ielen > ); > > - if (pwps_ie == NULL || wps_ielen == 0) > + if (!pwps_ie || wps_ielen == 0) > return; > > pwps_ie_src = pmlmepriv->wps_beacon_ie; > - if (pwps_ie_src == NULL) > + if (!pwps_ie_src) > return; > > wps_offset = (uint)(pwps_ie - ie); > @@ -2322,7 +2322,7 @@ void rtw_ap_restore_network(struct adapter *padapter) > for (i = 0; i < chk_alive_num; i++) { > psta = rtw_get_stainfo_by_offset(pstapriv, chk_alive_list[i]); > > - if (psta == NULL) { > + if (!psta) { > DBG_871X(FUNC_ADPT_FMT" sta_info is null\n", FUNC_ADPT_ARG(padapter)); > } else if (psta->state & _FW_LINKED) { > rtw_sta_media_status_rpt(padapter, psta, 1); > -- > 2.17.1 > > -- > You received this message because you are subscribed to the Google Groups "outreachy-kernel" group. > To unsubscribe from this group and stop receiving emails from it, send an email to outreachy-kernel+unsubscribe@googlegroups.com. > To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20200322202214.GA9750%40simran-Inspiron-5558. >