Skip to content

Commit

Permalink
ar5523: Use kzalloc instead of kmalloc/memset
Browse files Browse the repository at this point in the history
Use kzalloc rather than duplicating its implementation, which
makes code simple and easy to understand.

Signed-off-by: Haowen Bai <baihaowen@meizu.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Haowen Bai authored and David S. Miller committed Apr 20, 2022
1 parent fcd30c9 commit e63dd41
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions drivers/net/wireless/ath/ar5523/ar5523.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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);

Expand Down

0 comments on commit e63dd41

Please sign in to comment.