Commit 5043bd3c authored by Gargi Sharma's avatar Gargi Sharma Committed by Greg Kroah-Hartman

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: default avatarGargi Sharma <gs051095@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 3337134e
...@@ -88,7 +88,7 @@ static struct sk_buff *rtllib_ADDBA(struct rtllib_device *ieee, u8 *Dst, ...@@ -88,7 +88,7 @@ static struct sk_buff *rtllib_ADDBA(struct rtllib_device *ieee, u8 *Dst,
return NULL; return NULL;
} }
skb = dev_alloc_skb(len + sizeof(struct rtllib_hdr_3addr)); skb = dev_alloc_skb(len + sizeof(struct rtllib_hdr_3addr));
if (skb == NULL) if (!skb)
return NULL; return NULL;
memset(skb->data, 0, sizeof(struct rtllib_hdr_3addr)); memset(skb->data, 0, sizeof(struct rtllib_hdr_3addr));
...@@ -154,7 +154,7 @@ static struct sk_buff *rtllib_DELBA(struct rtllib_device *ieee, u8 *dst, ...@@ -154,7 +154,7 @@ static struct sk_buff *rtllib_DELBA(struct rtllib_device *ieee, u8 *dst,
DelbaParamSet.field.TID = pBA->BaParamSet.field.TID; DelbaParamSet.field.TID = pBA->BaParamSet.field.TID;
skb = dev_alloc_skb(len + sizeof(struct rtllib_hdr_3addr)); skb = dev_alloc_skb(len + sizeof(struct rtllib_hdr_3addr));
if (skb == NULL) if (!skb)
return NULL; return NULL;
skb_reserve(skb, ieee->tx_headroom); skb_reserve(skb, ieee->tx_headroom);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment