Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 15ed5398 authored by Elise Lennion's avatar Elise Lennion Committed by Greg Kroah-Hartman
Browse files

staging: rtl8192e: 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: default avatarElise Lennion <elise.lennion@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 7dd448f0
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -49,7 +49,7 @@ bool rtl92e_send_cmd_pkt(struct net_device *dev, u32 type, const void *data,
		else
			skb = dev_alloc_skb(frag_length + 4);

		if (skb == NULL) {
		if (!skb) {
			rt_status = false;
			goto Failed;
		}
+2 −2
Original line number Diff line number Diff line
@@ -130,7 +130,7 @@ rtllib_frag_cache_get(struct rtllib_device *ieee,
				    ETH_ALEN /* WDS */ +
				    /* QOS Control */
				    (RTLLIB_QOS_HAS_SEQ(fc) ? 2 : 0));
		if (skb == NULL)
		if (!skb)
			return NULL;

		entry = &ieee->frag_cache[tid][ieee->frag_next_idx[tid]];
@@ -1430,7 +1430,7 @@ static int rtllib_rx_InfraAdhoc(struct rtllib_device *ieee, struct sk_buff *skb,
	/* skb: hdr + (possible reassembled) full plaintext payload */
	payload = skb->data + hdrlen;
	rxb = kmalloc(sizeof(struct rtllib_rxb), GFP_ATOMIC);
	if (rxb == NULL)
	if (!rxb)
		goto rx_dropped;

	/* to parse amsdu packets */