aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFelix Schlepper <f3sch.git@outlook.com>2022-06-24 15:54:54 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-06-27 13:50:03 +0200
commit9fdc63fe40faaffeecaf3f1425dd1b27892f96fc (patch)
treec44f59d5cbf751f34c5c37ead63e993a87002c8e
parentStaging: rtl8192e: Use struct_size (diff)
downloadlinux-9fdc63fe40faaffeecaf3f1425dd1b27892f96fc.tar.gz
linux-9fdc63fe40faaffeecaf3f1425dd1b27892f96fc.zip
Staging: rtl8192e: Using kzalloc and delete memset
By using kzalloc, we can delete a memset. The practical difference is that using kzalloc() will zero out the txb->fragments[] array. The original code worked fine, but zeroing everything seems nicer. Signed-off-by: Felix Schlepper <f3sch.git@outlook.com> Link: https://lore.kernel.org/r/9727fe31c675f2f3052ca2fa586d137dd856ac91.1656078068.git.f3sch.git@outlook.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/staging/rtl8192e/rtllib_tx.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/staging/rtl8192e/rtllib_tx.c b/drivers/staging/rtl8192e/rtllib_tx.c
index f2ef32e943ae..1307cf55741a 100644
--- a/drivers/staging/rtl8192e/rtllib_tx.c
+++ b/drivers/staging/rtl8192e/rtllib_tx.c
@@ -205,11 +205,10 @@ static struct rtllib_txb *rtllib_alloc_txb(int nr_frags, int txb_size,
struct rtllib_txb *txb;
int i;
- txb = kmalloc(struct_size(txb, fragments, nr_frags), gfp_mask);
+ txb = kzalloc(struct_size(txb, fragments, 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);