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

Mariyam Shahid posted 1 patch 1 month, 3 weeks ago
There is a newer version of this series
drivers/staging/rtl8723bs/core/rtw_mlme.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
[PATCH v3] staging: rtl8723bs: Replace kzalloc with kzalloc_obj
Posted by Mariyam Shahid 1 month, 3 weeks ago
Replace kzalloc() using sizeof(*ptr) with kzalloc_obj()
to fix respective checkpatch warnings.

Signed-off-by: Mariyam Shahid <mariyam.shahid135@gmail.com>
---
 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
Re: [PATCH v3] staging: rtl8723bs: Replace kzalloc with kzalloc_obj
Posted by Ethan Tidmore 1 month, 3 weeks ago
On Sat Feb 21, 2026 at 5:10 AM CST, Mariyam Shahid wrote:
> Replace kzalloc() using sizeof(*ptr) with kzalloc_obj()
> to fix respective checkpatch warnings.
>
> Signed-off-by: Mariyam Shahid <mariyam.shahid135@gmail.com>
> ---
^^^
No changelog.

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

LGTM. Just include the changelog, in your v4 you can put:

Reviewed-by: Ethan Tidmore <ethantidmore06@gmail.com>

Thanks,

ET
[PATCH v4] staging: rtl8723bs: Replace kzalloc with kzalloc_obj
Posted by Mariyam Shahid 1 month, 3 weeks ago
Replace kzalloc() using sizeof(*ptr) with kzalloc_obj()
to fix respective checkpatch warnings.

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

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
Re: [PATCH v4] staging: rtl8723bs: Replace kzalloc with kzalloc_obj
Posted by Dan Carpenter 1 month, 3 weeks ago
On Sun, Feb 22, 2026 at 09:20:18PM +0500, Mariyam Shahid wrote:
> Replace kzalloc() using sizeof(*ptr) with kzalloc_obj()
> to fix respective checkpatch warnings.
> 
> Reviewed-by: Ethan Tidmore <ethantidmore06@gmail.com>
> Signed-off-by: Mariyam Shahid <mariyam.shahid135@gmail.com>
> ---
> 
> 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


I don't remember suggesting anything...  But, sure, looks good.

Reviewed-by: Dan Carpenter <dan.carpenter@linaro.org>

regards,
dan carpenter
Re: [PATCH v4] staging: rtl8723bs: Replace kzalloc with kzalloc_obj
Posted by Greg KH 1 month, 3 weeks ago
On Sun, Feb 22, 2026 at 09:20:18PM +0500, Mariyam Shahid wrote:
> Replace kzalloc() using sizeof(*ptr) with kzalloc_obj()
> to fix respective checkpatch warnings.
> 
> Reviewed-by: Ethan Tidmore <ethantidmore06@gmail.com>
> Signed-off-by: Mariyam Shahid <mariyam.shahid135@gmail.com>
> ---
> 
> 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

This is not how the _obj() calls are changing to work, please wait for
-rc1 to be out before doing stuff like this (see the changes that _just_
landed in Linus's tree for this.)

thanks,

greg k-h
Re: [PATCH v4] staging: rtl8723bs: Replace kzalloc with kzalloc_obj
Posted by Mariyam Shahid 1 month, 3 weeks ago
On Sun, Feb 22, 2026 at 9:42 PM Greg KH <gregkh@linuxfoundation.org> wrote:
>
> On Sun, Feb 22, 2026 at 09:20:18PM +0500, Mariyam Shahid wrote:
> > Replace kzalloc() using sizeof(*ptr) with kzalloc_obj()
> > to fix respective checkpatch warnings.
> >
> > Reviewed-by: Ethan Tidmore <ethantidmore06@gmail.com>
> > Signed-off-by: Mariyam Shahid <mariyam.shahid135@gmail.com>
> > ---
> >
> > 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
>
> This is not how the _obj() calls are changing to work, please wait for
> -rc1 to be out before doing stuff like this (see the changes that _just_
> landed in Linus's tree for this.)
>
> thanks,
>
> greg k-h

Hi Greg,

Understood, I'll review the new changes in Linus's tree, and update
the patch accordingly before resubmitting.

Thanks for the heads up.

Regards,
Mariyam