* [PATCH] staging/rtl8192u/ieee80211: replace kmalloc with kzalloc
@ 2020-10-23 10:05 Elena Afanasova
2020-10-23 10:32 ` [Outreachy kernel] " Julia Lawall
0 siblings, 1 reply; 2+ messages in thread
From: Elena Afanasova @ 2020-10-23 10:05 UTC (permalink / raw)
To: gregkh; +Cc: devel, outreachy-kernel, Elena Afanasova
kmalloc() and memset() calls can be replaced with kzalloc().
Found with Coccinelle.
Signed-off-by: Elena Afanasova <eafanasova@gmail.com>
---
drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c
index 63a561ab4a76..fb8483c499b3 100644
--- a/drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c
+++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c
@@ -227,13 +227,10 @@ 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);
if (!txb)
return NULL;
- memset(txb, 0, sizeof(struct ieee80211_txb));
txb->nr_frags = nr_frags;
txb->frag_size = __cpu_to_le16(txb_size);
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Outreachy kernel] [PATCH] staging/rtl8192u/ieee80211: replace kmalloc with kzalloc
2020-10-23 10:05 [PATCH] staging/rtl8192u/ieee80211: replace kmalloc with kzalloc Elena Afanasova
@ 2020-10-23 10:32 ` Julia Lawall
0 siblings, 0 replies; 2+ messages in thread
From: Julia Lawall @ 2020-10-23 10:32 UTC (permalink / raw)
To: Elena Afanasova; +Cc: gregkh, devel, outreachy-kernel
The above is not the right subject line for this file (ie the part to the
left of the colon). You should use git log --oneline on this file to see
what others have done.
julia
On Fri, 23 Oct 2020, Elena Afanasova wrote:
> kmalloc() and memset() calls can be replaced with kzalloc().
> Found with Coccinelle.
>
> Signed-off-by: Elena Afanasova <eafanasova@gmail.com>
> ---
> drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c | 5 +----
> 1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c
> index 63a561ab4a76..fb8483c499b3 100644
> --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c
> +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c
> @@ -227,13 +227,10 @@ 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);
> if (!txb)
> return NULL;
>
> - memset(txb, 0, sizeof(struct ieee80211_txb));
> txb->nr_frags = nr_frags;
> txb->frag_size = __cpu_to_le16(txb_size);
>
> --
> 2.25.1
>
> --
> 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 view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20201023100507.4569-1-eafanasova%40gmail.com.
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-10-23 10:32 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-10-23 10:05 [PATCH] staging/rtl8192u/ieee80211: replace kmalloc with kzalloc Elena Afanasova
2020-10-23 10:32 ` [Outreachy kernel] " Julia Lawall
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.