Update the memory allocation in _rtw_init_sta_priv() to use
sizeof(*pstapriv->pallocated_stainfo_buf) instead of explicitly
passing sizeof(struct sta_info).
This resolves the following checkpatch warning:
"Prefer vzalloc(sizeof(*pstapriv->pallocated_stainfo_buf)...) over
vzalloc(sizeof(struct sta_info)...)"
Using the pointer type is preferred in the kernel as it ensures the
allocated size remains correct even if the pointer's underlying type
changes in the future. The allocation was also split across multiple
lines to comply with column length limits.
Signed-off-by: Patryk Gawroński <gawronski1.6@gmail.com>
---
drivers/staging/rtl8723bs/core/rtw_sta_mgt.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/staging/rtl8723bs/core/rtw_sta_mgt.c b/drivers/staging/rtl8723bs/core/rtw_sta_mgt.c
index aea660f27959..0758d0540f4b 100644
--- a/drivers/staging/rtl8723bs/core/rtw_sta_mgt.c
+++ b/drivers/staging/rtl8723bs/core/rtw_sta_mgt.c
@@ -54,7 +54,8 @@ u32 _rtw_init_sta_priv(struct sta_priv *pstapriv)
struct sta_info *psta;
s32 i;
- pstapriv->pallocated_stainfo_buf = vzalloc(sizeof(struct sta_info) * NUM_STA + 4);
+ pstapriv->pallocated_stainfo_buf =
+ vzalloc(sizeof(*pstapriv->pallocated_stainfo_buf) * NUM_STA + 4);
if (!pstapriv->pallocated_stainfo_buf)
return _FAIL;
--
2.55.0