Skip to contentSkip to conversation

staging: rtl8723bs: Remove comparisons to NULL in conditionals

PATCH In review Simran Singhal 2 participants 4 messages Mar 22, 2020 – Mar 25, 2020 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: rtl8723bs: Remove comparisons to NULL in conditionals

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

---
 drivers/staging/rtl8723bs/core/rtw_ap.c | 30 ++++++++++++-------------
 1 file changed, 15 insertions(+), 15 deletions(-)
drivers/staging/rtl8723bs/core/rtw_ap.c +15 -15
index a76e81330756..82b977c07205 100644
@@ -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);
Signature · 1 line
2.17.1
#1 lore raw
Quoted 4 lines · Simran Singhal

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

Quoted 139 lines
---
 drivers/staging/rtl8723bs/core/rtw_ap.c | 30 ++++++++++++-------------
 1 file changed, 15 insertions(+), 15 deletions(-)
drivers/staging/rtl8723bs/core/rtw_ap.c +15 -16
index a76e81330756..82b977c07205 100644
@@ -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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20200322202214.GA9750%40simran-Inspiron-5558.

#2 lore raw
Quoted 4 lines · Julia Lawall

On Mon, 23 Mar 2020, Simran Singhal wrote:

Quoted 8 lines
Quoted 4 lines

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.

I am removing parentheses because then this patch will be generating two more warnings related to
"remove unnecessary parentheses" after fixing the NULL part.

Quoted 6 lines

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.

Noted. Will fix it in v2.

Quoted 6 lines

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?

Answer to "why" part is:-
Fixed coding style for null comparisons to be more consistent with the rest of the kernel coding style.
Will improve the commit log in v2.

Thanks
Simran

Quoted 161 lines

julia

Review

Quoted 7 lines
---
 drivers/staging/rtl8723bs/core/rtw_ap.c | 30 ++++++++++++-------------
 1 file changed, 15 insertions(+), 15 deletions(-)
(quoted diff) +0 -0

b/drivers/staging/rtl8723bs/core/rtw_ap.c

Quoted 13 lines

index a76e81330756..82b977c07205 100644

drivers/staging/rtl8723bs/core/rtw_ap.c +1 -1
@@ -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;

drivers/staging/rtl8723bs/core/rtw_ap.c static void update_BCNTIM(struct adapter *padapter) · line 104

Quoted 2 lines
drivers/staging/rtl8723bs/core/rtw_ap.c +0 -0
@@ -103,7 +103,7 @@ static void update_BCNTIM(struct adapter *padapter)
                              &tmp_len,
                              (pnetwork_mlmeext->IELength -

_BEACON_IE_OFFSET_)

drivers/staging/rtl8723bs/core/rtw_ap.c static void update_BCNTIM(struct adapter *padapter) · line 113

Quoted 9 lines
drivers/staging/rtl8723bs/core/rtw_ap.c +1 -1
                      );
-                     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_)

drivers/staging/rtl8723bs/core/rtw_ap.c int rtw_check_beacon_data(struct adapter

Quoted 7 lines
drivers/staging/rtl8723bs/core/rtw_ap.c +1 -1
                      );
-                     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)

drivers/staging/rtl8723bs/core/rtw_ap.c int rtw_check_beacon_data(struct adapter

Quoted 9 lines
drivers/staging/rtl8723bs/core/rtw_ap.c +1 -1
              &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)

drivers/staging/rtl8723bs/core/rtw_ap.c int rtw_check_beacon_data(struct adapter

Quoted 9 lines
drivers/staging/rtl8723bs/core/rtw_ap.c +1 -1
              &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)

drivers/staging/rtl8723bs/core/rtw_ap.c int rtw_check_beacon_data(struct adapter

Quoted 11 lines
drivers/staging/rtl8723bs/core/rtw_ap.c +2 -2
                      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)

drivers/staging/rtl8723bs/core/rtw_ap.c int rtw_check_beacon_data(struct adapter

Quoted 9 lines
drivers/staging/rtl8723bs/core/rtw_ap.c +1 -1
                              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)

drivers/staging/rtl8723bs/core/rtw_ap.c int rtw_check_beacon_data(struct adapter · line 1296

Quoted 1 line
drivers/staging/rtl8723bs/core/rtw_ap.c +0 -0
      psta = rtw_get_stainfo(&padapter->stapriv,

pbss_network->MacAddress);

drivers/staging/rtl8723bs/core/rtw_ap.c int rtw_check_beacon_data(struct adapter · line 1298

Quoted 2 lines
drivers/staging/rtl8723bs/core/rtw_ap.c +0 -0
      if (!psta) {
              psta = rtw_alloc_stainfo(&padapter->stapriv,

pbss_network->MacAddress);

drivers/staging/rtl8723bs/core/rtw_ap.c u8 rtw_ap_set_pairwise_key(struct adapter

Quoted 6 lines
drivers/staging/rtl8723bs/core/rtw_ap.c +1 -1
-             if (psta == NULL)
+             if (!psta)
                      return _FAIL;
      }
 
@@ -1453,7 +1453,7 @@ u8 rtw_ap_set_pairwise_key(struct adapter

*padapter, struct sta_info *psta)

drivers/staging/rtl8723bs/core/rtw_ap.c static void update_bcn_wps_ie(struct adapter

Quoted 24 lines
drivers/staging/rtl8723bs/core/rtw_ap.c +3 -3
      }
 
      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)

drivers/staging/rtl8723bs/core/rtw_ap.c void rtw_ap_restore_network(struct adapter

Quoted 14 lines
drivers/staging/rtl8723bs/core/rtw_ap.c +2 -2
              &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)

drivers/staging/rtl8723bs/core/rtw_ap.c void rtw_ap_restore_network(struct adapter · line 2323

Quoted 2 lines
drivers/staging/rtl8723bs/core/rtw_ap.c +0 -0
      for (i = 0; i < chk_alive_num; i++) {
              psta = rtw_get_stainfo_by_offset(pstapriv,

chk_alive_list[i]);

drivers/staging/rtl8723bs/core/rtw_ap.c void rtw_ap_restore_network(struct adapter *padapter)

Quoted 4 lines
drivers/staging/rtl8723bs/core/rtw_ap.c +1 -1
-             if (psta == NULL) {
+             if (!psta) {
                      DBG_871X(FUNC_ADPT_FMT" sta_info is null\n",

FUNC_ADPT_ARG(padapter));

Quoted 7 lines
drivers/staging/rtl8723bs/core/rtw_ap.c +0 -1
              } 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.

Quoted 1 line

To unsubscribe from this group and stop receiving emails from it, send

an email to [email protected].

Quoted 1 line

To view this discussion on the web visit

https://groups.google.com/d/msgid/outreachy-kernel/20200322202214.GA9750%40simran-Inspiron-5558
.

Quoted 1 line
#3 lore raw
Quoted 14 lines · Simran Singhal
Quoted 9 lines · Julia Lawall
Quoted 4 lines · Simran Singhal

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

Quoted 8 lines
Quoted 3 lines

The patch also drops some parentheses that are completely unrelated to the change described here. These changes should not be done in this patch.

I am removing parentheses because then this patch will be generating two more warnings related to
"remove unnecessary parentheses" after fixing the NULL part.

@Julia Lawall <[email protected]> what do you suggest?

Quoted 190 lines
Quoted 8 lines

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.

Noted. Will fix it in v2.

Quoted 6 lines

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?

Answer to "why" part is:-
Fixed coding style for null comparisons to be more consistent with the rest of the kernel coding style.
Will improve the commit log in v2.

Thanks
Simran

Quoted 161 lines

julia

Review

Quoted 7 lines
---
 drivers/staging/rtl8723bs/core/rtw_ap.c | 30 ++++++++++++-------------
 1 file changed, 15 insertions(+), 15 deletions(-)
(quoted diff) +0 -0

b/drivers/staging/rtl8723bs/core/rtw_ap.c

Quoted 13 lines

index a76e81330756..82b977c07205 100644

drivers/staging/rtl8723bs/core/rtw_ap.c +1 -1
@@ -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;

drivers/staging/rtl8723bs/core/rtw_ap.c static void update_BCNTIM(struct adapter *padapter) · line 104

Quoted 2 lines
drivers/staging/rtl8723bs/core/rtw_ap.c +0 -0
@@ -103,7 +103,7 @@ static void update_BCNTIM(struct adapter *padapter)
                              &tmp_len,
                              (pnetwork_mlmeext->IELength -

_BEACON_IE_OFFSET_)

drivers/staging/rtl8723bs/core/rtw_ap.c static void update_BCNTIM(struct adapter *padapter) · line 113

Quoted 9 lines
drivers/staging/rtl8723bs/core/rtw_ap.c +1 -1
                      );
-                     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_)

drivers/staging/rtl8723bs/core/rtw_ap.c int rtw_check_beacon_data(struct adapter

Quoted 7 lines
drivers/staging/rtl8723bs/core/rtw_ap.c +1 -1
                      );
-                     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)

drivers/staging/rtl8723bs/core/rtw_ap.c int rtw_check_beacon_data(struct adapter

Quoted 9 lines
drivers/staging/rtl8723bs/core/rtw_ap.c +1 -1
              &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)

drivers/staging/rtl8723bs/core/rtw_ap.c int rtw_check_beacon_data(struct adapter

Quoted 9 lines
drivers/staging/rtl8723bs/core/rtw_ap.c +1 -1
              &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)

drivers/staging/rtl8723bs/core/rtw_ap.c int rtw_check_beacon_data(struct adapter

Quoted 11 lines
drivers/staging/rtl8723bs/core/rtw_ap.c +2 -2
                      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)

drivers/staging/rtl8723bs/core/rtw_ap.c int rtw_check_beacon_data(struct adapter

Quoted 9 lines
drivers/staging/rtl8723bs/core/rtw_ap.c +1 -1
                              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)

drivers/staging/rtl8723bs/core/rtw_ap.c int rtw_check_beacon_data(struct adapter · line 1296

Quoted 1 line
drivers/staging/rtl8723bs/core/rtw_ap.c +0 -0
      psta = rtw_get_stainfo(&padapter->stapriv,

pbss_network->MacAddress);

drivers/staging/rtl8723bs/core/rtw_ap.c int rtw_check_beacon_data(struct adapter · line 1298

Quoted 2 lines
drivers/staging/rtl8723bs/core/rtw_ap.c +0 -0
      if (!psta) {
              psta = rtw_alloc_stainfo(&padapter->stapriv,

pbss_network->MacAddress);

drivers/staging/rtl8723bs/core/rtw_ap.c u8 rtw_ap_set_pairwise_key(struct adapter

Quoted 6 lines
drivers/staging/rtl8723bs/core/rtw_ap.c +1 -1
-             if (psta == NULL)
+             if (!psta)
                      return _FAIL;
      }
 
@@ -1453,7 +1453,7 @@ u8 rtw_ap_set_pairwise_key(struct adapter

*padapter, struct sta_info *psta)

drivers/staging/rtl8723bs/core/rtw_ap.c static void update_bcn_wps_ie(struct adapter

Quoted 24 lines
drivers/staging/rtl8723bs/core/rtw_ap.c +3 -3
      }
 
      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)

drivers/staging/rtl8723bs/core/rtw_ap.c void rtw_ap_restore_network(struct adapter

Quoted 14 lines
drivers/staging/rtl8723bs/core/rtw_ap.c +2 -2
              &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)

drivers/staging/rtl8723bs/core/rtw_ap.c void rtw_ap_restore_network(struct adapter · line 2323

Quoted 2 lines
drivers/staging/rtl8723bs/core/rtw_ap.c +0 -0
      for (i = 0; i < chk_alive_num; i++) {
              psta = rtw_get_stainfo_by_offset(pstapriv,

chk_alive_list[i]);

drivers/staging/rtl8723bs/core/rtw_ap.c void rtw_ap_restore_network(struct adapter *padapter)

Quoted 4 lines
drivers/staging/rtl8723bs/core/rtw_ap.c +1 -1
-             if (psta == NULL) {
+             if (!psta) {
                      DBG_871X(FUNC_ADPT_FMT" sta_info is null\n",

FUNC_ADPT_ARG(padapter));

Quoted 7 lines
drivers/staging/rtl8723bs/core/rtw_ap.c +0 -1
              } 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.

Quoted 1 line

To unsubscribe from this group and stop receiving emails from it, send

an email to [email protected].

Quoted 1 line

To view this discussion on the web visit

https://groups.google.com/d/msgid/outreachy-kernel/20200322202214.GA9750%40simran-Inspiron-5558
.

Quoted 1 line