wifi: ipw2x00: Use kzalloc() instead of kmalloc()/memset()
authorChen Ni <nichen@iscas.ac.cn>
Thu, 4 Jul 2024 09:06:22 +0000 (17:06 +0800)
committerKalle Valo <kvalo@kernel.org>
Tue, 9 Jul 2024 10:16:05 +0000 (13:16 +0300)
Replace kmalloc() + memset() to kzalloc() for
better code readability and simplicity.

Signed-off-by: Chen Ni <nichen@iscas.ac.cn>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://patch.msgid.link/20240704090622.2260102-1-nichen@iscas.ac.cn
drivers/net/wireless/intel/ipw2x00/libipw_tx.c

index 4aec1fce1ae297502c1f2c35c9f6f02c2a4ad0a8..e22a6732a4c3f2f3c61d04546aa862852e6a424a 100644 (file)
@@ -180,11 +180,10 @@ static struct libipw_txb *libipw_alloc_txb(int nr_frags, int txb_size,
        struct libipw_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 libipw_txb));
        txb->nr_frags = nr_frags;
        txb->frag_size = txb_size;