Skip to contentSkip to conversation

ar5523: Use kzalloc instead of kmalloc/memset

PATCH Applied Haowen Bai 2 participants 2 messages Apr 19, 2022 – Apr 20, 2022

Subsystems (3)
lore
Share & tools
lore

Haowen Bai

author
#0 lore raw

PATCH 1/1 ar5523: Use kzalloc instead of kmalloc/memset

Use kzalloc rather than duplicating its implementation, which makes code simple and easy to understand.

---
 drivers/net/wireless/ath/ar5523/ar5523.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/wireless/ath/ar5523/ar5523.c +1 -2
index 00ddeee123c2..9f84a6fde0c2 100644
@@ -1500,7 +1500,7 @@ static int ar5523_load_firmware(struct usb_device *dev)
 		return -ENOENT;
 	}
 
-	txblock = kmalloc(sizeof(*txblock), GFP_KERNEL);
+	txblock = kzalloc(sizeof(*txblock), GFP_KERNEL);
 	if (!txblock)
 		goto out;
 
@@ -1512,7 +1512,6 @@ static int ar5523_load_firmware(struct usb_device *dev)
 	if (!fwbuf)
 		goto out_free_rxblock;
 
-	memset(txblock, 0, sizeof(struct ar5523_fwblock));
 	txblock->flags = cpu_to_be32(AR5523_WRITE_BLOCK);
 	txblock->total = cpu_to_be32(fw->size);
 
Signature · 1 line
2.7.4
#1 lore raw
This patch was applied to netdev/net-next.git (master) by David S. Miller <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (master) by David S. Miller <[email protected]>:

Quoted 7 lines · On Tue, 19 Apr 2022 09:37:31 +0800 you wrote:

Use kzalloc rather than duplicating its implementation, which makes code simple and easy to understand.

---
 drivers/net/wireless/ath/ar5523/ar5523.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Here is the summary with links:
- ar5523: Use kzalloc instead of kmalloc/memset

    https://git.kernel.org/netdev/net-next/c/e63dd4123507

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html