staging: rtl8723bs: rewrite comparison to null
authorFabio Aiuto <fabioaiuto83@gmail.com>
Wed, 7 Apr 2021 13:49:39 +0000 (15:49 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 7 Apr 2021 15:13:03 +0000 (17:13 +0200)
fi following post-commit checkpatch issues:

CHECK: Comparison to NULL could be written "!p"
290: FILE: drivers/staging/rtl8723bs/core/rtw_mlme_ext.c:978:
+ if (p == NULL)
--
CHECK: Comparison to NULL could be written "!pmgntframe"
328: FILE: drivers/staging/rtl8723bs/core/rtw_mlme_ext.c:2016:
+ if (pmgntframe == NULL)
--
CHECK: Comparison to NULL could be written "!pmgntframe"
361: FILE: drivers/staging/rtl8723bs/core/rtw_mlme_ext.c:2378:
+ if (pmgntframe == NULL)
--
CHECK: Comparison to NULL could be written "!pmgntframe"
391: FILE: drivers/staging/rtl8723bs/core/rtw_mlme_ext.c:3478:
+ if (pmgntframe == NULL)
--
CHECK: Comparison to NULL could be written "!p"
427: FILE: drivers/staging/rtl8723bs/core/rtw_mlme_ext.c:4071:
+ if (p == NULL)
--
CHECK: Comparison to NULL could be written "!BIP_AAD"
781: FILE: drivers/staging/rtl8723bs/core/rtw_security.c:1690:
+ if (BIP_AAD == NULL)
--
CHECK: Comparison to NULL could be written "!pwep"
1773: FILE: drivers/staging/rtl8723bs/os_dep/ioctl_linux.c:3062:
+ if (pwep == NULL)
--
CHECK: Comparison to NULL could be written "!pmlmepriv->wps_beacon_ie"
1784: FILE: drivers/staging/rtl8723bs/os_dep/ioctl_linux.c:3510:
+ if (pmlmepriv->wps_beacon_ie == NULL)
--
CHECK: Comparison to NULL could be written "!pmlmepriv->wps_probe_resp_ie"
1795: FILE: drivers/staging/rtl8723bs/os_dep/ioctl_linux.c:3544:
+ if (pmlmepriv->wps_probe_resp_ie == NULL)
--
CHECK: Comparison to NULL could be written "!pmlmepriv->wps_assoc_resp_ie"
1807: FILE: drivers/staging/rtl8723bs/os_dep/ioctl_linux.c:3574:
+ if (pmlmepriv->wps_assoc_resp_ie == NULL)
--
CHECK: Comparison to NULL could be written "!pbuf"
1818: FILE: drivers/staging/rtl8723bs/os_dep/ioctl_linux.c:3928:
+ if (pbuf == NULL)
--
CHECK: Comparison to NULL could be written "!if1"
1944: FILE: drivers/staging/rtl8723bs/os_dep/sdio_intf.c:392:
+ if (if1 == NULL)

CHECK: Using comparison to false is error prone
402: FILE: drivers/staging/rtl8723bs/core/rtw_mlme_ext.c:3890:
+ if (false == bxmitok)
--
CHECK: Using comparison to true is error prone
671: FILE: drivers/staging/rtl8723bs/core/rtw_recv.c:365:
+ if ((prxattrib->bdecrypted == true) && (brpt_micerror == true))
--
CHECK: Using comparison to true is error prone
1051: FILE: drivers/staging/rtl8723bs/core/rtw_xmit.c:1174:
+ if (padapter->securitypriv.binstallBIPkey != true)
--
CHECK: Using comparison to false is error prone
1632: FILE: drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c:2194:
+ if (false == bMatched)

Signed-off-by: Fabio Aiuto <fabioaiuto83@gmail.com>
Link: https://lore.kernel.org/r/572f96dcb6217fd3e6ea23c37b55b0ebb3231f14.1617802415.git.fabioaiuto83@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
drivers/staging/rtl8723bs/core/rtw_recv.c
drivers/staging/rtl8723bs/core/rtw_security.c
drivers/staging/rtl8723bs/core/rtw_xmit.c
drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
drivers/staging/rtl8723bs/os_dep/sdio_intf.c

index 1ed4342..7f998a2 100644 (file)
@@ -975,7 +975,7 @@ unsigned int OnAuthClient(struct adapter *padapter, union recv_frame *precv_fram
                        p = rtw_get_ie(pframe + WLAN_HDR_A3_LEN + _AUTH_IE_OFFSET_, WLAN_EID_CHALLENGE, (int *)&len,
                                pkt_len - WLAN_HDR_A3_LEN - _AUTH_IE_OFFSET_);
 
-                       if (p == NULL)
+                       if (!p)
                                goto authclnt_fail;
 
                        memcpy((void *)(pmlmeinfo->chg_txt), (void *)(p + 2), len);
@@ -2013,7 +2013,7 @@ static struct xmit_frame *_alloc_mgtxmitframe(struct xmit_priv *pxmitpriv, bool
        else
                pmgntframe = rtw_alloc_xmitframe_ext(pxmitpriv);
 
-       if (pmgntframe == NULL)
+       if (!pmgntframe)
                goto exit;
 
        pxmitbuf = rtw_alloc_xmitbuf_ext(pxmitpriv);
@@ -2375,7 +2375,7 @@ void issue_probersp(struct adapter *padapter, unsigned char *da, u8 is_valid_p2p
                return;
 
        pmgntframe = alloc_mgtxmitframe(pxmitpriv);
-       if (pmgntframe == NULL)
+       if (!pmgntframe)
                return;
 
        /* update attribute */
@@ -3475,7 +3475,7 @@ void issue_action_SA_Query(struct adapter *padapter, unsigned char *raddr, unsig
        __le16 le_tmp;
 
        pmgntframe = alloc_mgtxmitframe(pxmitpriv);
-       if (pmgntframe == NULL)
+       if (!pmgntframe)
                return;
 
        /* update attribute */
@@ -3887,7 +3887,7 @@ unsigned int send_beacon(struct adapter *padapter)
        }
 
 
-       if (false == bxmitok)
+       if (!bxmitok)
                return _FAIL;
        else
                return _SUCCESS;
@@ -4068,7 +4068,7 @@ u8 collect_bss_info(struct adapter *padapter, union recv_frame *precv_frame, str
 
        /*  checking SSID */
        p = rtw_get_ie(bssid->IEs + ie_offset, WLAN_EID_SSID, &len, bssid->IELength - ie_offset);
-       if (p == NULL)
+       if (!p)
                return _FAIL;
 
        if (*(p + 1)) {
index 866b8c5..18ad719 100644 (file)
@@ -362,7 +362,7 @@ static signed int recvframe_chkmic(struct adapter *adapter,  union recv_frame *p
                                if ((IS_MCAST(prxattrib->ra) == true)  && (prxattrib->key_index != pmlmeinfo->key_index))
                                        brpt_micerror = false;
 
-                               if ((prxattrib->bdecrypted == true) && (brpt_micerror == true))
+                               if ((prxattrib->bdecrypted) && (brpt_micerror))
                                        rtw_handle_tkip_mic_err(adapter, (u8)IS_MCAST(prxattrib->ra));
 
                                res = _FAIL;
index bb15b5a..9587d89 100644 (file)
@@ -1687,7 +1687,7 @@ u32 rtw_BIP_verify(struct adapter *padapter, u8 *precvframe)
        ori_len = pattrib->pkt_len-WLAN_HDR_A3_LEN+BIP_AAD_SIZE;
        BIP_AAD = rtw_zmalloc(ori_len);
 
-       if (BIP_AAD == NULL)
+       if (!BIP_AAD)
                return _FAIL;
 
        /* PKT start */
index af69f2d..77378f7 100644 (file)
@@ -1171,7 +1171,7 @@ s32 rtw_mgmt_xmitframe_coalesce(struct adapter *padapter, struct sk_buff *pkt, s
                goto xmitframe_coalesce_success;
 
        /* IGTK key is not install, it may not support 802.11w */
-       if (padapter->securitypriv.binstallBIPkey != true)
+       if (!padapter->securitypriv.binstallBIPkey)
                goto xmitframe_coalesce_success;
 
        /* station mode doesn't need TX BIP, just ready the code */
index ca58ea6..f96322b 100644 (file)
@@ -2191,7 +2191,7 @@ static int cfg80211_rtw_del_pmksa(struct wiphy *wiphy,
                }
        }
 
-       if (false == bMatched)
+       if (!bMatched)
                return -EINVAL;
 
        return 0;
index 40adecb..679deb7 100644 (file)
@@ -3059,7 +3059,7 @@ static int rtw_set_encryption(struct net_device *dev, struct ieee_param *param,
                        wep_key_len = wep_key_len <= 5 ? 5 : 13;
                        wep_total_len = wep_key_len + FIELD_OFFSET(struct ndis_802_11_wep, KeyMaterial);
                        pwep = kzalloc(wep_total_len, GFP_KERNEL);
-                       if (pwep == NULL)
+                       if (!pwep)
                                goto exit;
 
                        pwep->KeyLength = wep_key_len;
@@ -3507,7 +3507,7 @@ static int rtw_set_wps_beacon(struct net_device *dev, struct ieee_param *param,
        if (ie_len > 0) {
                pmlmepriv->wps_beacon_ie = rtw_malloc(ie_len);
                pmlmepriv->wps_beacon_ie_len = ie_len;
-               if (pmlmepriv->wps_beacon_ie == NULL)
+               if (!pmlmepriv->wps_beacon_ie)
                        return -EINVAL;
 
                memcpy(pmlmepriv->wps_beacon_ie, param->u.bcn_ie.buf, ie_len);
@@ -3541,7 +3541,7 @@ static int rtw_set_wps_probe_resp(struct net_device *dev, struct ieee_param *par
        if (ie_len > 0) {
                pmlmepriv->wps_probe_resp_ie = rtw_malloc(ie_len);
                pmlmepriv->wps_probe_resp_ie_len = ie_len;
-               if (pmlmepriv->wps_probe_resp_ie == NULL)
+               if (!pmlmepriv->wps_probe_resp_ie)
                        return -EINVAL;
 
                memcpy(pmlmepriv->wps_probe_resp_ie, param->u.bcn_ie.buf, ie_len);
@@ -3571,7 +3571,7 @@ static int rtw_set_wps_assoc_resp(struct net_device *dev, struct ieee_param *par
        if (ie_len > 0) {
                pmlmepriv->wps_assoc_resp_ie = rtw_malloc(ie_len);
                pmlmepriv->wps_assoc_resp_ie_len = ie_len;
-               if (pmlmepriv->wps_assoc_resp_ie == NULL)
+               if (!pmlmepriv->wps_assoc_resp_ie)
                        return -EINVAL;
 
                memcpy(pmlmepriv->wps_assoc_resp_ie, param->u.bcn_ie.buf, ie_len);
@@ -3925,7 +3925,7 @@ static int rtw_test(
        len = wrqu->data.length;
 
        pbuf = rtw_zmalloc(len);
-       if (pbuf == NULL)
+       if (!pbuf)
                return -ENOMEM;
 
        if (copy_from_user(pbuf, wrqu->data.pointer, len)) {
index 7010bdd..5de4c70 100644 (file)
@@ -389,7 +389,7 @@ static int rtw_drv_init(
                goto exit;
 
        if1 = rtw_sdio_if1_init(dvobj, id);
-       if (if1 == NULL)
+       if (!if1)
                goto free_dvobj;
 
        /* dev_alloc_name && register_netdev */