[PATCH v4] staging: rtl8723bs: Replace kzalloc with kzalloc_obj

From: Mariyam Shahid

Date: Sun Feb 22 2026 - 11:20:37 EST


Replace kzalloc() using sizeof(*ptr) with kzalloc_obj()
to fix respective checkpatch warnings.

Reviewed-by: Ethan Tidmore <ethantidmore06@xxxxxxxxx>
Signed-off-by: Mariyam Shahid <mariyam.shahid135@xxxxxxxxx>
---

v4: added changelog
v3: rebased on staging-next, kzalloc_obj now available in this tree
v2: switched to kzalloc_obj as suggested by Dan Carpenter
v1: initial submission

drivers/staging/rtl8723bs/core/rtw_mlme.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme.c b/drivers/staging/rtl8723bs/core/rtw_mlme.c
index 22dc36e8e38a..1bc90fa48d36 100644
--- a/drivers/staging/rtl8723bs/core/rtw_mlme.c
+++ b/drivers/staging/rtl8723bs/core/rtw_mlme.c
@@ -1875,13 +1875,13 @@ signed int rtw_set_auth(struct adapter *adapter, struct security_priv *psecurity
struct cmd_priv *pcmdpriv = &adapter->cmdpriv;
signed int res = _SUCCESS;

- pcmd = kzalloc(sizeof(*pcmd), GFP_KERNEL);
+ pcmd = kzalloc_obj(*pcmd, GFP_KERNEL);
if (!pcmd) {
res = _FAIL; /* try again */
goto exit;
}

- psetauthparm = kzalloc(sizeof(*psetauthparm), GFP_KERNEL);
+ psetauthparm = kzalloc_obj(*psetauthparm, GFP_KERNEL);
if (!psetauthparm) {
kfree(pcmd);
res = _FAIL;
@@ -1912,7 +1912,7 @@ signed int rtw_set_key(struct adapter *adapter, struct security_priv *psecurityp
struct cmd_priv *pcmdpriv = &adapter->cmdpriv;
signed int res = _SUCCESS;

- psetkeyparm = kzalloc(sizeof(*psetkeyparm), GFP_KERNEL);
+ psetkeyparm = kzalloc_obj(*psetkeyparm, GFP_KERNEL);
if (!psetkeyparm) {
res = _FAIL;
goto exit;
@@ -1954,7 +1954,7 @@ signed int rtw_set_key(struct adapter *adapter, struct security_priv *psecurityp
}

if (enqueue) {
- pcmd = kzalloc(sizeof(*pcmd), GFP_KERNEL);
+ pcmd = kzalloc_obj(*pcmd, GFP_KERNEL);
if (!pcmd) {
kfree(psetkeyparm);
res = _FAIL; /* try again */
--
2.43.0