Skip to contentSkip to conversation

drivers:staging:wilc1000 Fix comparison to NULL messages

PATCH In review Bogicevic Sasa 2 participants 3 messages Nov 17, 2015 – Nov 18, 2015 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drivers:staging:wilc1000 Fix comparison to NULL messages

This fixes all "Comparison to NULL could be written like..." messages from checkpatch.pl

---
 drivers/staging/wilc1000/coreconfigurator.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/staging/wilc1000/coreconfigurator.c +5 -5
index fd7240c..a31ac55 100644
@@ -434,7 +434,7 @@ s32 parse_network_info(u8 *pu8MsgBuffer, tstrNetworkInfo **ppstrNetworkInfo)
 
 		/* Get DTIM Period */
 		pu8TimElm = get_tim_elm(pu8msa, u16RxLen + FCS_LEN, u8index);
-		if (pu8TimElm != NULL)
+		if (!pu8TimElm)
 			pstrNetworkInfo->u8DtimPeriod = pu8TimElm[3];
 		pu8IEs = &pu8msa[MAC_HDR_LEN + TIME_STAMP_LEN + BEACON_INTERVAL_LEN + CAP_INFO_LEN];
 		u16IEsLen = u16RxLen - (MAC_HDR_LEN + TIME_STAMP_LEN + BEACON_INTERVAL_LEN + CAP_INFO_LEN);
@@ -468,8 +468,8 @@ s32 DeallocateNetworkInfo(tstrNetworkInfo *pstrNetworkInfo)
 {
 	s32 s32Error = 0;
 
-	if (pstrNetworkInfo != NULL) {
-		if (pstrNetworkInfo->pu8IEs != NULL) {
+	if (!pstrNetworkInfo) {
+		if (!pstrNetworkInfo->pu8IEs) {
 			kfree(pstrNetworkInfo->pu8IEs);
 			pstrNetworkInfo->pu8IEs = NULL;
 		} else {
@@ -553,8 +553,8 @@ s32 DeallocateAssocRespInfo(tstrConnectRespInfo *pstrConnectRespInfo)
 {
 	s32 s32Error = 0;
 
-	if (pstrConnectRespInfo != NULL) {
-		if (pstrConnectRespInfo->pu8RespIEs != NULL) {
+	if (!pstrConnectRespInfo) {
+		if (!pstrConnectRespInfo->pu8RespIEs) {
 			kfree(pstrConnectRespInfo->pu8RespIEs);
 			pstrConnectRespInfo->pu8RespIEs = NULL;
 		} else {
Signature · 1 line
2.1.4
#1 lore raw
Quoted 13 lines · Bogicevic Sasa

This fixes all "Comparison to NULL could be written like..." messages from checkpatch.pl

---
 drivers/staging/wilc1000/coreconfigurator.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/staging/wilc1000/coreconfigurator.c +0 -0
index fd7240c..a31ac55 100644

drivers/staging/wilc1000/coreconfigurator.c s32 parse_network_info(u8 *pu8MsgBuffer, tstrNetworkInfo **ppstrNetworkInfo) · line 437

Quoted 5 lines
drivers/staging/wilc1000/coreconfigurator.c +1 -1
@@ -434,7 +434,7 @@ s32 parse_network_info(u8 *pu8MsgBuffer, tstrNetworkInfo **ppstrNetworkInfo)
 
 		/* Get DTIM Period */
 		pu8TimElm = get_tim_elm(pu8msa, u16RxLen + FCS_LEN, u8index);
-		if (pu8TimElm != NULL)
+		if (!pu8TimElm)

You are now checking for - if (pu8TimElm == NULL) It should actually be: if (pu8TimElm)

regards
sudip

#2 lore raw
Quoted 23 lines · Sudip Mukherjee
Quoted 13 lines · Bogicevic Sasa

This fixes all "Comparison to NULL could be written like..." messages from checkpatch.pl

---
 drivers/staging/wilc1000/coreconfigurator.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/staging/wilc1000/coreconfigurator.c +0 -0
index fd7240c..a31ac55 100644

drivers/staging/wilc1000/coreconfigurator.c s32 parse_network_info(u8 *pu8MsgBuffer, tstrNetworkInfo **ppstrNetworkInfo) · line 437

Quoted 5 lines
drivers/staging/wilc1000/coreconfigurator.c +1 -1
@@ -434,7 +434,7 @@ s32 parse_network_info(u8 *pu8MsgBuffer, tstrNetworkInfo **ppstrNetworkInfo)
 
 		/* Get DTIM Period */
 		pu8TimElm = get_tim_elm(pu8msa, u16RxLen + FCS_LEN, u8index);
-		if (pu8TimElm != NULL)
+		if (!pu8TimElm)

You are now checking for - if (pu8TimElm == NULL) It should actually be: if (pu8TimElm)

Quoted 2 lines

regards
sudip

Right, so stuped, Ill resend it