Skip to contentSkip to conversation

Staging: rtl8712: Remove zero-testing pointer typed value

PATCH New Amitoj Kaur Chawla 1 participant 1 message Mar 31, 2015 Staging

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 Staging: rtl8712: Remove zero-testing pointer typed value

Removes variable comparison with 0 by using !. Done using following coccinelle script.

@ disable is_zero,isnt_zero @
expression *E;
expression E1,f;
@@

E = f(...)
<...
(
- E == 0
+ !E
|
- E != 0
+ E
|
- 0 == E
+ !E
|
- 0 != E
+ E
)
...>
?E = E1

@ disable is_zero,isnt_zero @
expression *E;
@@

(
E ==
- 0
+ NULL
|
E !=
- 0
+ NULL
|
- 0
+ NULL
== E
|
- 0
+ NULL
!= E
)

---
Changes in v2:
-Removed unnecessary comparison testing change

 drivers/staging/rtl8712/rtl871x_security.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/rtl8712/rtl871x_security.c +1 -1
index a178c23..bcd1a51 100644
@@ -153,7 +153,7 @@ static u32 getcrc32(u8 *buf, u32 len)
 	u8 *p;
 	u32  crc;
 
-	if (bcrc32initialized == 0)
+	if (!bcrc32initialized)
 		crc32_init();
 	crc = 0xffffffff; /* preload shift register, per CRC-32 spec */
 	for (p = buf; len > 0; ++p, --len)
Signature · 1 line
1.9.1