[PATCH v3] staging: rtl8723bs: replace kzalloc/kmalloc+memcpy with kmemdup

Alexandru Hossu posted 1 patch 1 month, 1 week ago
drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
[PATCH v3] staging: rtl8723bs: replace kzalloc/kmalloc+memcpy with kmemdup
Posted by Alexandru Hossu 1 month, 1 week ago
Replace open-coded alloc+memcpy patterns with kmemdup().
This simplifies the code and avoids manual size/copy handling.

Signed-off-by: Alexandru Hossu <hossu.alexandru@gmail.com>

v3:
  - Drop unrelated DT binding changes from v2.
  - Wrap long line reported by checkpatch.

---
 drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
index 1295b1c1e..0f50f7141 100644
--- a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
+++ b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
@@ -128,7 +128,8 @@ static struct ieee80211_supported_band *rtw_spt_band_alloc(
 		goto exit;
 
 	spt_band->channels = (struct ieee80211_channel *)(((u8 *)spt_band) + sizeof(struct ieee80211_supported_band));
-	spt_band->bitrates = (struct ieee80211_rate *)(((u8 *)spt_band->channels) + array_size(n_channels, sizeof(struct ieee80211_channel)));
+	spt_band->bitrates = (struct ieee80211_rate *)(((u8 *)spt_band->channels) +
+		array_size(n_channels, sizeof(struct ieee80211_channel)));
 	spt_band->band = band;
 	spt_band->n_channels = n_channels;
 	spt_band->n_bitrates = n_bitrates;
-- 
2.43.0