All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Bhumika Goyal <bhumirks@gmail.com>
Cc: outreachy-kernel@googlegroups.com
Subject: Re: [Outreachy kernel] [PATCH] Staging: rtl8192u: Use kzalloc instead of kmalloc and memset
Date: Fri, 11 Mar 2016 10:01:20 -0800	[thread overview]
Message-ID: <20160311180120.GA14824@kroah.com> (raw)
In-Reply-To: <1456844139-29008-1-git-send-email-bhumirks@gmail.com>

On Tue, Mar 01, 2016 at 08:25:39PM +0530, Bhumika Goyal wrote:
> The code in this patch allocates some memory and then clears it. The
> function kzalloc does the both so replace kmalloc and memset with
> kzalloc. Also sizeof(struct ieee80211_txb) can be written as
> sizeof(*txb) as txb is a pointer of type struct ieee80211_txb.
> Done using coccinelle:
> 
> @@
> expression e,e1,e2;
> @@
> - e=kmalloc(e1,e2);
> + e=kzalloc(e1,e2);
> if(!e)
>   return NULL;
> ...
> - memset(e,...);
> 
> Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
> ---
>  drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c
> index 1ab0aea..8662137 100644
> --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c
> +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c
> @@ -242,13 +242,11 @@ static struct ieee80211_txb *ieee80211_alloc_txb(int nr_frags, int txb_size,
>  {
>  	struct ieee80211_txb *txb;
>  	int i;
> -	txb = kmalloc(
> -		sizeof(struct ieee80211_txb) + (sizeof(u8 *) * nr_frags),
> -		gfp_mask);
> +	txb = kzalloc(sizeof(*txb) + (sizeof(u8 *) * nr_frags),
> +		      gfp_mask);

This no longer needs to be line-wrapped, right?

Please fix.

thanks,

greg k-h


      reply	other threads:[~2016-03-11 18:01 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-01 14:55 [PATCH] Staging: rtl8192u: Use kzalloc instead of kmalloc and memset Bhumika Goyal
2016-03-11 18:01 ` Greg KH [this message]

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=20160311180120.GA14824@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=bhumirks@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.