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

staging: rtl8192u: Replace explicit NULL comparison

Replace explicit NULL comparison with ! operator to
simplify code.

Found with Coccinelle script:
@@
expression ptr;
position p;
statement s0, s1;
@@

ptr@p =
\(kmalloc\|devm_kzalloc\|kmalloc_array\|devm_ioremap\|usb_alloc_urb\|
alloc_netdev\|dev_alloc_skb\)(...)
... when != ptr

if (
(
+ !
ptr
- == NULL
)
) s0 else s1

Signed-off-by: Gargi Sharma <gs051095@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Gargi Sharma and committed by
Greg Kroah-Hartman
3337134e c01496a7

+2 -2
+2 -2
drivers/staging/rtl8192u/ieee80211/rtl819x_BAProc.c
··· 117 117 return NULL; 118 118 } 119 119 skb = dev_alloc_skb(len + sizeof( struct rtl_80211_hdr_3addr)); //need to add something others? FIXME 120 - if (skb == NULL) { 120 + if (!skb) { 121 121 IEEE80211_DEBUG(IEEE80211_DL_ERR, "can't alloc skb for ADDBA_REQ\n"); 122 122 return NULL; 123 123 } ··· 202 202 DelbaParamSet.field.TID = pBA->BaParamSet.field.TID; 203 203 204 204 skb = dev_alloc_skb(len + sizeof( struct rtl_80211_hdr_3addr)); //need to add something others? FIXME 205 - if (skb == NULL) { 205 + if (!skb) { 206 206 IEEE80211_DEBUG(IEEE80211_DL_ERR, "can't alloc skb for ADDBA_REQ\n"); 207 207 return NULL; 208 208 }