diff mbox series

[-next] wifi: mac80211: Use kvmemdup to simplify the code

Message ID 20240821023325.2077399-1-ruanjinjie@huawei.com
State New
Headers show
Series [-next] wifi: mac80211: Use kvmemdup to simplify the code | expand

Commit Message

Jinjie Ruan Aug. 21, 2024, 2:33 a.m. UTC
Use kvmemdup instead of kvmalloc() + memcpy() to simplify the code.

No functional change.

Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
---
 drivers/net/wireless/broadcom/brcm80211/brcmsmac/mac80211_if.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Ping-Ke Shih Aug. 21, 2024, 3:42 a.m. UTC | #1
Jinjie Ruan <ruanjinjie@huawei.com> wrote:
> 
> Use kvmemdup instead of kvmalloc() + memcpy() to simplify the code.
> 
> No functional change.
> 
> Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
> ---
>  drivers/net/wireless/broadcom/brcm80211/brcmsmac/mac80211_if.c | 3 +--

Subject prefix should be "wifi: brcmsmac:".
diff mbox series

Patch

diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/mac80211_if.c b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/mac80211_if.c
index d86f28b8bc60..7717d7764d2d 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/mac80211_if.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/mac80211_if.c
@@ -1611,10 +1611,9 @@  int brcms_ucode_init_buf(struct brcms_info *wl, void **pbuf, u32 idx)
 			if (le32_to_cpu(hdr->idx) == idx) {
 				pdata = wl->fw.fw_bin[i]->data +
 					le32_to_cpu(hdr->offset);
-				*pbuf = kvmalloc(len, GFP_KERNEL);
+				*pbuf = kvmemdup(pdata, len, GFP_KERNEL);
 				if (*pbuf == NULL)
 					goto fail;
-				memcpy(*pbuf, pdata, len);
 				return 0;
 			}
 		}