[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <191737a8900.279b.9b12b7fc0a3841636cfb5e919b41b954@broadcom.com>
Date: Wed, 21 Aug 2024 07:48:27 +0200
From: Arend Van Spriel <arend.vanspriel@...adcom.com>
To: Jinjie Ruan <ruanjinjie@...wei.com>, <kvalo@...nel.org>, <johannes.berg@...el.com>, <emmanuel.grumbach@...el.com>, <erick.archer@...look.com>, <linux-wireless@...r.kernel.org>, <brcm80211@...ts.linux.dev>, <brcm80211-dev-list.pdl@...adcom.com>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH -next] wifi: mac80211: Use kvmemdup to simplify the code
On August 21, 2024 4:26:17 AM Jinjie Ruan <ruanjinjie@...wei.com> wrote:
> Use kvmemdup instead of kvmalloc() + memcpy() to simplify the code.
>
> No functional change.
Comment below...
> Signed-off-by: Jinjie Ruan <ruanjinjie@...wei.com>
> ---
> drivers/net/wireless/broadcom/brcm80211/brcmsmac/mac80211_if.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> 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;
This is the only jump to fail: so instead simply return here with -ENOMEM
and remove the fail: label.
Regards,
Arend
> - memcpy(*pbuf, pdata, len);
> return 0;
> }
> }
> --
> 2.34.1
Powered by blists - more mailing lists