[PATCH] ipw2x00: Use kzalloc instead of kmalloc/memset

Chen Ni posted 1 patch 1 year, 7 months ago
drivers/net/wireless/intel/ipw2x00/libipw_tx.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
[PATCH] ipw2x00: Use kzalloc instead of kmalloc/memset
Posted by Chen Ni 1 year, 7 months ago
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(-)

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;
 
-- 
2.25.1
Re: wifi: ipw2x00: Use kzalloc() instead of kmalloc()/memset()
Posted by Kalle Valo 1 year, 7 months ago
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()

-- 
https://patchwork.kernel.org/project/linux-wireless/patch/20240704090622.2260102-1-nichen@iscas.ac.cn/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches