staging: rtl8192e: replace kmalloc/memset with kzalloc
PATCH v2 1/1 staging: rtl8192e: replace kmalloc/memset with kzalloc
Replace kmalloc + memset 0 by a call to kzalloc which zeroes memory too. Found with Coccinelle.
Signed-off-by Elena Afanasova <[email protected]>
---
Changes in v2:
- correct the subject line
- correct the commit message
drivers/staging/rtl8192e/rtllib_tx.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/staging/rtl8192e/rtllib_tx.c +1 -3
@@ -205,12 +205,10 @@ static struct rtllib_txb *rtllib_alloc_txb(int nr_frags, int txb_size,struct rtllib_txb *txb;int i; - txb =kmalloc (sizeof (struct rtllib_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 rtllib_txb )); txb->nr_frags = nr_frags; txb->frag_size =cpu_to_le16 (txb_size);
Signature · 1 line
2.25.1
Greg KH
maintainerQuoted 17 lines · Elena Afanasova
Replace kmalloc + memset 0 by a call to kzalloc which zeroes memory too. Found with Coccinelle.
Signed-off-by Elena Afanasova <[email protected]>---
Changes in v2:
- correct the subject line
- correct the commit messagedrivers/staging/rtl8192e/rtllib_tx.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)drivers/staging/rtl8192e/rtllib_tx.c +0
-0
drivers/staging/rtl8192e/rtllib_tx.c static struct rtllib_txb *rtllib_alloc_txb(int nr_frags, int txb_size, · line 208
Quoted 6 lines
drivers/staging/rtl8192e/rtllib_tx.c +1
-2@@ -205,12 +205,10 @@ static struct rtllib_txb *rtllib_alloc_txb(int nr_frags, int txb_size,struct rtllib_txb *txb;int i; - txb =kmalloc (sizeof (struct rtllib_txb ) + (sizeof (u8 *) * nr_frags), - gfp_mask); + txb =kzalloc (sizeof (*txb) + (sizeof (u8 *) * nr_frags), gfp_mask);
Same here, please always use array_size()