Skip to contentSkip to conversation

Staging: rtl8188eu: core: rtw_mlme.c: Replace NULL comparision.

PATCH Superseded Sanjana Sanikommu 2 participants 3 messages Mar 18, 2019 Staging

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Staging: rtl8188eu: core: rtw_mlme.c: Replace NULL comparision.

Replace NULL comparison with '!' in the file rtw_mlme.c Issue found by checkpatch.pl semantic patch results for rtw_mlme.c

CHECK:Comparision to NULL could be written "!candidate"

---
 drivers/staging/rtl8188eu/core/rtw_mlme.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/rtl8188eu/core/rtw_mlme.c +1 -1
index cbee02a86d22..ecac6b428154 100644
@@ -1438,7 +1438,7 @@ static int rtw_check_join_candidate(struct mlme_priv *pmlmepriv
 			goto exit;
 	}
 
-	if (*candidate == NULL || (*candidate)->network.Rssi < competitor->network.Rssi) {
+	if (!(*candidate) || (*candidate)->network.Rssi < competitor->network.Rssi) {
 		*candidate = competitor;
 		updated = true;
 	}
Signature · 1 line
2.17.1
#1 lore raw
Quoted 2 lines · Sanjana Sanikommu

Replace NULL comparison with '!' in the file rtw_mlme.c Issue found by checkpatch.pl semantic patch results for rtw_mlme.c

You don't need to add the parentheses.

julia

Quoted 31 lines

CHECK:Comparision to NULL could be written "!candidate"

---
 drivers/staging/rtl8188eu/core/rtw_mlme.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/rtl8188eu/core/rtw_mlme.c +1 -2
index cbee02a86d22..ecac6b428154 100644
@@ -1438,7 +1438,7 @@ static int rtw_check_join_candidate(struct mlme_priv *pmlmepriv
 			goto exit;
 	}
 
-	if (*candidate == NULL || (*candidate)->network.Rssi < competitor->network.Rssi) {
+	if (!(*candidate) || (*candidate)->network.Rssi < competitor->network.Rssi) {
 		*candidate = competitor;
 		updated = true;
 	}
--

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 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/20190318132203.13505-1-sanjana99reddy99%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

#2 lore raw
Quoted 10 lines · Julia Lawall
Quoted 2 lines · Sanjana Sanikommu

Replace NULL comparison with '!' in the file rtw_mlme.c Issue found by checkpatch.pl semantic patch results for rtw_mlme.c

You don't need to add the parentheses.

I would remove them in next version.
Thank you.
Sanjana

Quoted 44 lines

julia

Review

Quoted 9 lines

CHECK:Comparision to NULL could be written "!candidate"

Signed-off-by Sanjana Sanikommu <[email protected] <javascript:>>

---

 drivers/staging/rtl8188eu/core/rtw_mlme.c | 2 +- 
 1 file changed, 1 insertion(+), 1 deletion(-) 
(quoted diff) +0 -0

b/drivers/staging/rtl8188eu/core/rtw_mlme.c

drivers/staging/rtl8188eu/core/rtw_mlme.c static int rtw_check_join_candidate(struct

Quoted 4 lines

index cbee02a86d22..ecac6b428154 100644

drivers/staging/rtl8188eu/core/rtw_mlme.c +0 -0
@@ -1438,7 +1438,7 @@ static int rtw_check_join_candidate(struct 

mlme_priv *pmlmepriv

drivers/staging/rtl8188eu/core/rtw_mlme.c static int rtw_check_join_candidate(struct mlme_priv *pmlmepriv

Quoted 4 lines
drivers/staging/rtl8188eu/core/rtw_mlme.c +0 -1
                         goto exit; 
         } 
 
-        if (*candidate == NULL || (*candidate)->network.Rssi < 

competitor->network.Rssi) {

drivers/staging/rtl8188eu/core/rtw_mlme.c static int rtw_check_join_candidate(struct · line 1441

Quoted 1 line
drivers/staging/rtl8188eu/core/rtw_mlme.c +1 -0
+        if (!(*candidate) || (*candidate)->network.Rssi < 

competitor->network.Rssi) {

Quoted 8 lines
drivers/staging/rtl8188eu/core/rtw_mlme.c +0 -0
                 *candidate = competitor; 
                 updated = true; 
         } 
Signature · 4 lines
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] <javascript:>.

Quoted 1 line

To post to this group, send email to [email protected]

<javascript:>.

Quoted 1 line

To view this discussion on the web visit

https://groups.google.com/d/msgid/outreachy-kernel/20190318132203.13505-1-sanjana99reddy99%40gmail.com.

Quoted 2 lines

For more options, visit https://groups.google.com/d/optout.