Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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

...+> }

Signed-off-by: Elise Lennion <elise.lennion@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Elise Lennion and committed by
Greg Kroah-Hartman
6e8cb1cf 15ed5398

+1 -1
+1 -1
drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c
··· 129 129 8 /* WEP */ + 130 130 ETH_ALEN /* WDS */ + 131 131 (IEEE80211_QOS_HAS_SEQ(fc)?2:0) /* QOS Control */); 132 - if (skb == NULL) 132 + if (!skb) 133 133 return NULL; 134 134 135 135 entry = &ieee->frag_cache[tid][ieee->frag_next_idx[tid]];