From: Jinjie Ruan <ruanjinjie@huawei.com>
To: Arend Van Spriel <arend.vanspriel@broadcom.com>,
<kvalo@kernel.org>, <johannes.berg@intel.com>,
<emmanuel.grumbach@intel.com>, <erick.archer@outlook.com>,
<linux-wireless@vger.kernel.org>, <brcm80211@lists.linux.dev>,
<brcm80211-dev-list.pdl@broadcom.com>,
<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH -next] wifi: mac80211: Use kvmemdup to simplify the code
Date: Wed, 21 Aug 2024 14:43:40 +0800 [thread overview]
Message-ID: <232f5fe4-661a-501c-4a54-d3d45822b5fc@huawei.com> (raw)
In-Reply-To: <191737a8900.279b.9b12b7fc0a3841636cfb5e919b41b954@broadcom.com>
On 2024/8/21 13:48, Arend Van Spriel wrote:
> On August 21, 2024 4:26:17 AM Jinjie Ruan <ruanjinjie@huawei.com> wrote:
>
>> Use kvmemdup instead of kvmalloc() + memcpy() to simplify the code.
>>
>> No functional change.
>
> Comment below...
>
>> 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(-)
>>
>> 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.
Right. Thank you!
>
> Regards,
> Arend
>
>> - memcpy(*pbuf, pdata, len);
>> return 0;
>> }
>> }
>> --
>> 2.34.1
>
>
>
prev parent reply other threads:[~2024-08-21 6:43 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-21 2:33 Jinjie Ruan
2024-08-21 3:42 ` Ping-Ke Shih
2024-08-21 5:48 ` Arend Van Spriel
2024-08-21 6:43 ` Jinjie Ruan [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=232f5fe4-661a-501c-4a54-d3d45822b5fc@huawei.com \
--to=ruanjinjie@huawei.com \
--cc=arend.vanspriel@broadcom.com \
--cc=brcm80211-dev-list.pdl@broadcom.com \
--cc=brcm80211@lists.linux.dev \
--cc=emmanuel.grumbach@intel.com \
--cc=erick.archer@outlook.com \
--cc=johannes.berg@intel.com \
--cc=kvalo@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®