Skip to contentSkip to conversation

staging: rtl8192u: Standardize test for NULL.

PATCH In review Elise Lennion 1 participant 1 message Oct 21, 2016 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 2/3 staging: rtl8192u: Standardize test for NULL.

The test for NULL of the return variable of functions was changed from (ret == NULL) to !ret to match the standard.

Coccinelle was used with semantic patch:
@@
expression e;
identifier id, f;
statement S;
@@

f(...) { <+...

id = \(kmalloc\|devm_kzalloc\|kmalloc_array\|devm_ioremap \|usb_alloc_urb\|alloc_netdev\|dev_alloc_skb\) (...)

... when any

    when != id = e

+ if (!id)
- if (\(NULL == id\|id == NULL\))
S

...+> }

---
 drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c +1 -1
index 89cbc07..a44eb81 100644
@@ -129,7 +129,7 @@ ieee80211_frag_cache_get(struct ieee80211_device *ieee,
 				    8 /* WEP */ +
 				    ETH_ALEN /* WDS */ +
 				    (IEEE80211_QOS_HAS_SEQ(fc)?2:0) /* QOS Control */);
-		if (skb == NULL)
+		if (!skb)
 			return NULL;
 
 		entry = &ieee->frag_cache[tid][ieee->frag_next_idx[tid]];
Signature · 1 line
2.7.4