Skip to contentSkip to conversation

staging: rtl8192e: replace comparison to NULL by bool

PATCH In review Mitali Borkar 3 participants 4 messages Apr 9, 2021 – Apr 10, 2021 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: rtl8192e: replace comparison to NULL by bool

Fixed Comparison to NULL can be written as '!...' by replacing it with simpler form i.e boolean expression. This makes code more readable alternative. Reported by checkpatch.

---
 drivers/staging/rtl8192e/rtl819x_TSProc.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/staging/rtl8192e/rtl819x_TSProc.c +3 -3
index 65eac33aaa5b..476875125e87 100644
@@ -269,12 +269,12 @@ static void MakeTSEntry(struct ts_common_info *pTsCommonInfo, u8 *Addr,
 {
 	u8	count;
 
-	if (pTsCommonInfo == NULL)
+	if (!pTsCommonInfo)
 		return;
 
 	memcpy(pTsCommonInfo->Addr, Addr, 6);
 
-	if (pTSPEC != NULL)
+	if (pTSPEC)
 		memcpy((u8 *)(&(pTsCommonInfo->TSpec)), (u8 *)pTSPEC,
 		       sizeof(union tspec_body));
 
@@ -328,7 +328,7 @@ bool GetTs(struct rtllib_device *ieee, struct ts_common_info **ppTS,
 	}
 
 	*ppTS = SearchAdmitTRStream(ieee, Addr, UP, TxRxSelect);
-	if (*ppTS != NULL)
+	if (ppTS)
 		return true;
 
 	if (!bAddNewTs) {
Signature · 1 line
2.30.2
#1 lore raw
Quoted 29 lines · Mitali Borkar

Fixed Comparison to NULL can be written as '!...' by replacing it with simpler form i.e boolean expression. This makes code more readable alternative. Reported by checkpatch.

---
 drivers/staging/rtl8192e/rtl819x_TSProc.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/staging/rtl8192e/rtl819x_TSProc.c +2 -2
index 65eac33aaa5b..476875125e87 100644
@@ -269,12 +269,12 @@ static void MakeTSEntry(struct ts_common_info *pTsCommonInfo, u8 *Addr,
 {
 	u8	count;
 
-	if (pTsCommonInfo == NULL)
+	if (!pTsCommonInfo)
 		return;
 
 	memcpy(pTsCommonInfo->Addr, Addr, 6);
 
-	if (pTSPEC != NULL)
+	if (pTSPEC)
 		memcpy((u8 *)(&(pTsCommonInfo->TSpec)), (u8 *)pTSPEC,
 		       sizeof(union tspec_body));
 

drivers/staging/rtl8192e/rtl819x_TSProc.c bool GetTs(struct rtllib_device *ieee, struct ts_common_info **ppTS, · line 331

Quoted 5 lines
drivers/staging/rtl8192e/rtl819x_TSProc.c +1 -1
@@ -328,7 +328,7 @@ bool GetTs(struct rtllib_device *ieee, struct ts_common_info **ppTS,
 	}
 
 	*ppTS = SearchAdmitTRStream(ieee, Addr, UP, TxRxSelect);
-	if (*ppTS != NULL)
+	if (ppTS)

You lost a * here.

julia

Quoted 11 lines
drivers/staging/rtl8192e/rtl819x_TSProc.c +0 -1
 		return true;
 
 	if (!bAddNewTs) {
--

2.30.2

--
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/YHDnWpWztxeZospi%40kali.

maintainer
#2 lore raw
Quoted 32 lines · Julia Lawall
Quoted 28 lines · Mitali Borkar

Fixed Comparison to NULL can be written as '!...' by replacing it with simpler form i.e boolean expression. This makes code more readable alternative. Reported by checkpatch.

---
 drivers/staging/rtl8192e/rtl819x_TSProc.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/staging/rtl8192e/rtl819x_TSProc.c +2 -2
index 65eac33aaa5b..476875125e87 100644
@@ -269,12 +269,12 @@ static void MakeTSEntry(struct ts_common_info *pTsCommonInfo, u8 *Addr,
 {
 	u8	count;
 
-	if (pTsCommonInfo == NULL)
+	if (!pTsCommonInfo)
 		return;
 
 	memcpy(pTsCommonInfo->Addr, Addr, 6);
 
-	if (pTSPEC != NULL)
+	if (pTSPEC)
 		memcpy((u8 *)(&(pTsCommonInfo->TSpec)), (u8 *)pTSPEC,
 		       sizeof(union tspec_body));
 
Quoted 8 lines

drivers/staging/rtl8192e/rtl819x_TSProc.c bool GetTs(struct rtllib_device *ieee, struct ts_common_info **ppTS, · line 331

Quoted 6 lines
drivers/staging/rtl8192e/rtl819x_TSProc.c +1 -1
@@ -328,7 +328,7 @@ bool GetTs(struct rtllib_device *ieee, struct ts_common_info **ppTS,
 	}
 
 	*ppTS = SearchAdmitTRStream(ieee, Addr, UP, TxRxSelect);
-	if (*ppTS != NULL)
+	if (ppTS)

You lost a * here.

Ugh, good catch.

Mitali, can you send me a fix-up patch for this, or do you want me to drop your original patch from my tree?

thanks,

greg k-h

#3 lore raw
Quoted 42 lines · Greg KH
Quoted 32 lines · Julia Lawall
Quoted 28 lines · Mitali Borkar

Fixed Comparison to NULL can be written as '!...' by replacing it with simpler form i.e boolean expression. This makes code more readable alternative. Reported by checkpatch.

---
 drivers/staging/rtl8192e/rtl819x_TSProc.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/staging/rtl8192e/rtl819x_TSProc.c +2 -2
index 65eac33aaa5b..476875125e87 100644
@@ -269,12 +269,12 @@ static void MakeTSEntry(struct ts_common_info *pTsCommonInfo, u8 *Addr,
 {
 	u8	count;
 
-	if (pTsCommonInfo == NULL)
+	if (!pTsCommonInfo)
 		return;
 
 	memcpy(pTsCommonInfo->Addr, Addr, 6);
 
-	if (pTSPEC != NULL)
+	if (pTSPEC)
 		memcpy((u8 *)(&(pTsCommonInfo->TSpec)), (u8 *)pTSPEC,
 		       sizeof(union tspec_body));
 
Quoted 8 lines

drivers/staging/rtl8192e/rtl819x_TSProc.c bool GetTs(struct rtllib_device *ieee, struct ts_common_info **ppTS, · line 331

Quoted 6 lines
drivers/staging/rtl8192e/rtl819x_TSProc.c +1 -1
@@ -328,7 +328,7 @@ bool GetTs(struct rtllib_device *ieee, struct ts_common_info **ppTS,
 	}
 
 	*ppTS = SearchAdmitTRStream(ieee, Addr, UP, TxRxSelect);
-	if (*ppTS != NULL)
+	if (ppTS)

You lost a * here.

Quoted 5 lines

Ugh, good catch.

Mitali, can you send me a fix-up patch for this, or do you want me to drop your original patch from my tree?

Yes Sir, I am making corrections right now in this patch. Will send the fix up patch in an hour.

Quoted 3 lines

thanks,

greg k-h