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

staging: rtl8192e: 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
5043bd3c 3337134e

+2 -2
+2 -2
drivers/staging/rtl8192e/rtl819x_BAProc.c
··· 88 88 return NULL; 89 89 } 90 90 skb = dev_alloc_skb(len + sizeof(struct rtllib_hdr_3addr)); 91 - if (skb == NULL) 91 + if (!skb) 92 92 return NULL; 93 93 94 94 memset(skb->data, 0, sizeof(struct rtllib_hdr_3addr)); ··· 154 154 DelbaParamSet.field.TID = pBA->BaParamSet.field.TID; 155 155 156 156 skb = dev_alloc_skb(len + sizeof(struct rtllib_hdr_3addr)); 157 - if (skb == NULL) 157 + if (!skb) 158 158 return NULL; 159 159 160 160 skb_reserve(skb, ieee->tx_headroom);