Skip to contentSkip to conversation

Staging: rtl8723au: rtw_mlme_ext: Remove irrelevant test expression

PATCH Superseded Shivani Bhardwaj 2 participants 3 messages Oct 14, 2015 Staging

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 Staging: rtl8723au: rtw_mlme_ext: Remove irrelevant test expression

Logical and-ing of a struct and its member should be replaced by the member only as the struct has already been tested before for true value.

---
Changes in v2:
-Fix mistakes in commit message.

 drivers/staging/rtl8723au/core/rtw_mlme_ext.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/rtl8723au/core/rtw_mlme_ext.c +1 -1
index fca22ba..d28f29a 100644
@@ -1715,7 +1715,7 @@ OnAssocReq23a(struct rtw_adapter *padapter, struct recv_frame *precv_frame)
 	spin_unlock_bh(&pstapriv->asoc_list_lock);
 
 	/*  now the station is qualified to join our BSS... */
-	if (pstat && pstat->state & WIFI_FW_ASSOC_SUCCESS &&
+	if (pstat->state & WIFI_FW_ASSOC_SUCCESS &&
 	    status == WLAN_STATUS_SUCCESS) {
 		/* 1 bss_cap_update & sta_info_update23a */
 		bss_cap_update_on_sta_join23a(padapter, pstat);
Signature · 1 line
2.1.0
#1 lore raw
Quoted 2 lines · Shivani Bhardwaj

Logical and-ing of a struct and its member should be replaced by the member only as the struct has already been tested before for true value.

I think it woud be better to say "non-null". Even though it is true that && is a boolean operator, that should take true and false as arguments, that's not really what is being tested for here.

julia

Quoted 31 lines

---
Changes in v2:
-Fix mistakes in commit message.

 drivers/staging/rtl8723au/core/rtw_mlme_ext.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/rtl8723au/core/rtw_mlme_ext.c +1 -2
index fca22ba..d28f29a 100644
@@ -1715,7 +1715,7 @@ OnAssocReq23a(struct rtw_adapter *padapter, struct recv_frame *precv_frame)
 	spin_unlock_bh(&pstapriv->asoc_list_lock);
 
 	/*  now the station is qualified to join our BSS... */
-	if (pstat && pstat->state & WIFI_FW_ASSOC_SUCCESS &&
+	if (pstat->state & WIFI_FW_ASSOC_SUCCESS &&
 	    status == WLAN_STATUS_SUCCESS) {
 		/* 1 bss_cap_update & sta_info_update23a */
 		bss_cap_update_on_sta_join23a(padapter, pstat);
--

2.1.0

--
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 post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20151014094929.GA3545%40ubuntu.
For more options, visit https://groups.google.com/d/optout.

#2 lore raw
Quoted 11 lines · Julia Lawall
Quoted 2 lines · Shivani Bhardwaj

Logical and-ing of a struct and its member should be replaced by the member only as the struct has already been tested before for true value.

I think it woud be better to say "non-null". Even though it is true that && is a boolean operator, that should take true and false as arguments, that's not really what is being tested for here.

julia

All right.
Thank you.

Quoted 31 lines
Quoted 31 lines

---
Changes in v2:
-Fix mistakes in commit message.

 drivers/staging/rtl8723au/core/rtw_mlme_ext.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/rtl8723au/core/rtw_mlme_ext.c +1 -2
index fca22ba..d28f29a 100644
@@ -1715,7 +1715,7 @@ OnAssocReq23a(struct rtw_adapter *padapter, struct recv_frame *precv_frame)
      spin_unlock_bh(&pstapriv->asoc_list_lock);
 
      /*  now the station is qualified to join our BSS... */
-     if (pstat && pstat->state & WIFI_FW_ASSOC_SUCCESS &&
+     if (pstat->state & WIFI_FW_ASSOC_SUCCESS &&
          status == WLAN_STATUS_SUCCESS) {
              /* 1 bss_cap_update & sta_info_update23a */
              bss_cap_update_on_sta_join23a(padapter, pstat);
--

2.1.0

--
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 post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20151014094929.GA3545%40ubuntu.
For more options, visit https://groups.google.com/d/optout.