mirror of
https://github.com/torvalds/linux.git
synced 2026-05-27 16:44:58 +02:00
wifi: wfx: Use devm_kmemdup to replace devm_kmalloc + memcpy
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> Reviewed-by: Jérôme Pouiller <jerome.pouiller@silabs.com> Signed-off-by: Kalle Valo <kvalo@kernel.org> Link: https://lore.kernel.org/r/20230810114939.2104013-1-lizetao1@huawei.com
This commit is contained in:
parent
7d8473c799
commit
eaa8023e9b
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user