mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@intel.com>
To: Minu Jin <s9430939@naver.com>
Cc: gregkh@linuxfoundation.org, hansg@kernel.org,
	dan.carpenter@linaro.org, trohan2000@gmail.com, andy@kernel.org,
	linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org,
	straube.linux@gmail.com
Subject: Re: [PATCH v3 2/4] staging: rtl8723bs: replace rtw_zmalloc with kzalloc
Date: Thu, 29 Jan 2026 00:02:22 +0200	[thread overview]
Message-ID: <aXqHbhkXPiZVpqcS@smile.fi.intel.com> (raw)
In-Reply-To: <20260128140954.1065382-3-s9430939@naver.com>

On Wed, Jan 28, 2026 at 11:09:52PM +0900, Minu Jin wrote:
> replaces the wrapper function rtw_zmalloc with kzalloc.
> 
> I reviewed all the call sites to determine the appropriate GFP flags:
> - GFP_KERNEL: Used for initialization and configuration paths.
>   init/probe, config/setup
> 
> - GFP_ATOMIC: Used for critical real-time paths.
>   including interrupts, timer handler, region where spinlocks are held

Below I suggest more changes, but probably they needs to be done as separate
patches. It depends on Greg's preferences.

The change itself LGTM.

...

> -	ph2c = rtw_zmalloc(sizeof(struct cmd_obj));
> +	ph2c = kzalloc(sizeof(struct cmd_obj), GFP_KERNEL);

Since you are touching this line it might be worth to check and convert to use
sizeof(*) instead (but it needs to be done with a carefulness.

>  	if (!ph2c) {
>  		res = _FAIL;
>  		goto exit;
>  	}
>  

...

> -	pcmdpriv->cmd_allocated_buf = rtw_zmalloc(MAX_CMDSZ + CMDBUFF_ALIGN_SZ);
> +	pcmdpriv->cmd_allocated_buf = kzalloc(MAX_CMDSZ + CMDBUFF_ALIGN_SZ, GFP_ATOMIC);

>  

You can drop this blank line at the same time, we usually don't split
allocations and checks.

>  	if (!pcmdpriv->cmd_allocated_buf)
>  		return -ENOMEM;
>  
>  	pcmdpriv->cmd_buf = PTR_ALIGN(pcmdpriv->cmd_allocated_buf, CMDBUFF_ALIGN_SZ);
>  
> -	pcmdpriv->rsp_allocated_buf = rtw_zmalloc(MAX_RSPSZ + 4);
> +	pcmdpriv->rsp_allocated_buf = kzalloc(MAX_RSPSZ + 4, GFP_ATOMIC);
>  

Ditto.

>  	if (!pcmdpriv->rsp_allocated_buf) {
>  		kfree(pcmdpriv->cmd_allocated_buf);

...

> -				passoc_req = rtw_zmalloc(psta->assoc_req_len);
> +				passoc_req = kzalloc(psta->assoc_req_len, GFP_ATOMIC);

>  				if (passoc_req) {
>  					assoc_req_len = psta->assoc_req_len;
>  					memcpy(passoc_req, psta->passoc_req, assoc_req_len);

This  might be a candidate to kmemdup(), but double check it (it looks like
_len:s maybe different.

...

> -	spt_band = rtw_zmalloc(sizeof(struct ieee80211_supported_band) +
> +	spt_band = kzalloc(sizeof(struct ieee80211_supported_band) +
>  			       sizeof(struct ieee80211_channel) * n_channels +
> -			       sizeof(struct ieee80211_rate) * n_bitrates);
> +			       sizeof(struct ieee80211_rate) * n_bitrates, GFP_KERNEL);

This needs a bit of array_size(), struct_size() conversion.

-- 
With Best Regards,
Andy Shevchenko



  reply	other threads:[~2026-01-28 22:02 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-28 14:09 [PATCH v3 0/4] staging: rtl8723bs: remove memory allocation wrappers Minu Jin
2026-01-28 14:09 ` [PATCH v3 1/4] staging: rtl8723bs: replace _rtw_malloc with kmalloc Minu Jin
2026-01-28 21:51   ` Andy Shevchenko
2026-01-28 21:52     ` Andy Shevchenko
2026-01-28 14:09 ` [PATCH v3 2/4] staging: rtl8723bs: replace rtw_zmalloc with kzalloc Minu Jin
2026-01-28 22:02   ` Andy Shevchenko [this message]
2026-01-28 14:09 ` [PATCH v3 3/4] staging: rtl8723bs: replace skb allocation wrappers and fix build Minu Jin
2026-01-28 22:04   ` Andy Shevchenko
2026-01-28 14:09 ` [PATCH v3 4/4] staging: rtl8723bs: remove unused allocation wrapper functions Minu Jin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aXqHbhkXPiZVpqcS@smile.fi.intel.com \
    --to=andriy.shevchenko@intel.com \
    --cc=andy@kernel.org \
    --cc=dan.carpenter@linaro.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=hansg@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=s9430939@naver.com \
    --cc=straube.linux@gmail.com \
    --cc=trohan2000@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®