From: "Jérôme Pouiller" <jerome.pouiller@silabs.com>
To: kvalo@kernel.org, Li Zetao <lizetao1@huawei.com>
Cc: lizetao1@huawei.com, linux-wireless@vger.kernel.org
Subject: Re: [PATCH -next] wifi: wfx: Use devm_kmemdup to replace devm_kmalloc + memcpy
Date: Thu, 10 Aug 2023 14:44:19 +0200 [thread overview]
Message-ID: <2435182.NgBsaNRSFp@pc-42> (raw)
In-Reply-To: <20230810114939.2104013-1-lizetao1@huawei.com>
On Thursday 10 August 2023 13:49:39 CEST Li Zetao wrote:
> Use the helper function devm_kmemdup() rather than duplicating its
> implementation, which helps to enhance code readability.
>
> Signed-off-by: Li Zetao <lizetao1@huawei.com>
> ---
> drivers/net/wireless/silabs/wfx/main.c | 7 +++----
> 1 file changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/net/wireless/silabs/wfx/main.c b/drivers/net/wireless/silabs/wfx/main.c
> index 0b50f7058bbb..ede822d771aa 100644
> --- a/drivers/net/wireless/silabs/wfx/main.c
> +++ b/drivers/net/wireless/silabs/wfx/main.c
> @@ -293,13 +293,12 @@ struct wfx_dev *wfx_init_common(struct device *dev, const struct wfx_platform_da
> hw->wiphy->max_scan_ie_len = IEEE80211_MAX_DATA_LEN;
> hw->wiphy->n_iface_combinations = ARRAY_SIZE(wfx_iface_combinations);
> hw->wiphy->iface_combinations = wfx_iface_combinations;
> - hw->wiphy->bands[NL80211_BAND_2GHZ] = devm_kmalloc(dev, sizeof(wfx_band_2ghz), GFP_KERNEL);
> + /* FIXME: also copy wfx_rates and wfx_2ghz_chantable */
> + hw->wiphy->bands[NL80211_BAND_2GHZ] = devm_kmemdup(dev, &wfx_band_2ghz,
> + sizeof(wfx_band_2ghz), GFP_KERNEL);
> if (!hw->wiphy->bands[NL80211_BAND_2GHZ])
> goto err;
>
> - /* FIXME: also copy wfx_rates and wfx_2ghz_chantable */
> - memcpy(hw->wiphy->bands[NL80211_BAND_2GHZ], &wfx_band_2ghz, sizeof(wfx_band_2ghz));
> -
> wdev = hw->priv;
> wdev->hw = hw;
> wdev->dev = dev;
> --
> 2.34.1
>
>
Make sense.
Reviewed-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
--
Jérôme Pouiller
next prev parent reply other threads:[~2023-08-10 12:44 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-10 11:49 [PATCH -next] wifi: wfx: Use devm_kmemdup to replace devm_kmalloc + memcpy Li Zetao
2023-08-10 12:44 ` Jérôme Pouiller [this message]
2023-08-23 11:09 ` Kalle Valo
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=2435182.NgBsaNRSFp@pc-42 \
--to=jerome.pouiller@silabs.com \
--cc=kvalo@kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=lizetao1@huawei.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.