diff mbox series

ipw2x00: Use kzalloc instead of kmalloc/memset

Message ID 20240704090622.2260102-1-nichen@iscas.ac.cn (mailing list archive)
State Accepted
Commit 3588e6438a1c2e353616959ce16bce06aef0e424
Delegated to: Kalle Valo
Headers show
Series ipw2x00: Use kzalloc instead of kmalloc/memset | expand

Commit Message

Chen Ni July 4, 2024, 9:06 a.m. UTC
replace kmalloc + memset to kzalloc for
better code readability and simplicity.

Signed-off-by: Chen Ni <nichen@iscas.ac.cn>
---
 drivers/net/wireless/intel/ipw2x00/libipw_tx.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Kalle Valo July 9, 2024, 10:16 a.m. UTC | #1
Chen Ni <nichen@iscas.ac.cn> wrote:

> Replace kmalloc() + memset() to kzalloc() for
> better code readability and simplicity.
> 
> Signed-off-by: Chen Ni <nichen@iscas.ac.cn>

Patch applied to wireless-next.git, thanks.

3588e6438a1c wifi: ipw2x00: Use kzalloc() instead of kmalloc()/memset()
diff mbox series

Patch

diff --git a/drivers/net/wireless/intel/ipw2x00/libipw_tx.c b/drivers/net/wireless/intel/ipw2x00/libipw_tx.c
index 4aec1fce1ae2..e22a6732a4c3 100644
--- a/drivers/net/wireless/intel/ipw2x00/libipw_tx.c
+++ b/drivers/net/wireless/intel/ipw2x00/libipw_tx.c
@@ -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;