From: Julia Lawall <julia.lawall@lip6.fr>
To: Gargi Sharma <gs051095@gmail.com>
Cc: outreachy-kernel@googlegroups.com, gregkh@linuxfoundation.org
Subject: Re: [Outreachy kernel] [PATCH] staging: rtl8192e: replace explicit NULL comparison
Date: Thu, 23 Feb 2017 21:32:32 +0100 (CET) [thread overview]
Message-ID: <alpine.DEB.2.20.1702232132020.2103@hadrien> (raw)
In-Reply-To: <1487880419-28962-1-git-send-email-gs051095@gmail.com>
On Fri, 24 Feb 2017, Gargi Sharma wrote:
> Replace explicit NULL comparison with ! operator to
> simplify code.
This change is already made in my kernel, suggesting that I already acked
some other patch doing the same thing.
julia
>
> 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>
> ---
> drivers/staging/rtl8192e/rtl819x_BAProc.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/staging/rtl8192e/rtl819x_BAProc.c b/drivers/staging/rtl8192e/rtl819x_BAProc.c
> index 20260af..1d39631 100644
> --- a/drivers/staging/rtl8192e/rtl819x_BAProc.c
> +++ b/drivers/staging/rtl8192e/rtl819x_BAProc.c
> @@ -88,7 +88,7 @@ static struct sk_buff *rtllib_ADDBA(struct rtllib_device *ieee, u8 *Dst,
> return NULL;
> }
> skb = dev_alloc_skb(len + sizeof(struct rtllib_hdr_3addr));
> - if (skb == NULL)
> + if (!skb)
> return NULL;
>
> 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,
> DelbaParamSet.field.TID = pBA->BaParamSet.field.TID;
>
> skb = dev_alloc_skb(len + sizeof(struct rtllib_hdr_3addr));
> - if (skb == NULL)
> + if (!skb)
> return NULL;
>
> skb_reserve(skb, ieee->tx_headroom);
> --
> 2.7.4
>
> --
> You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to outreachy-kernel+unsubscribe@googlegroups.com.
> To post to this group, send email to outreachy-kernel@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/1487880419-28962-1-git-send-email-gs051095%40gmail.com.
> For more options, visit https://groups.google.com/d/optout.
>
next prev parent reply other threads:[~2017-02-23 20:32 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-23 20:06 [PATCH] staging: rtl8192e: replace explicit NULL comparison Gargi Sharma
2017-02-23 20:32 ` Julia Lawall [this message]
2017-02-23 20:39 ` [Outreachy kernel] " Gargi Sharma
2017-02-24 17:26 ` Greg KH
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.DEB.2.20.1702232132020.2103@hadrien \
--to=julia.lawall@lip6.fr \
--cc=gregkh@linuxfoundation.org \
--cc=gs051095@gmail.com \
--cc=outreachy-kernel@googlegroups.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.