[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aXHBm-HRYuV8QH4r@stanley.mountain>
Date: Thu, 22 Jan 2026 09:20:11 +0300
From: Dan Carpenter <dan.carpenter@...aro.org>
To: Minu Jin <s9430939@...er.com>
Cc: gregkh@...uxfoundation.org, linux-staging@...ts.linux.dev,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] staging: rtl8723bs: use kzalloc directly in _rtw_zmalloc
On Tue, Jan 20, 2026 at 02:40:36PM +0900, Minu Jin wrote:
> Replace kmalloc + memset with kzalloc for simpler and cleaner code.
>
> Signed-off-by: Minu Jin <s9430939@...er.com>
> ---
> drivers/staging/rtl8723bs/os_dep/osdep_service.c | 7 +------
> 1 file changed, 1 insertion(+), 6 deletions(-)
>
> diff --git a/drivers/staging/rtl8723bs/os_dep/osdep_service.c b/drivers/staging/rtl8723bs/os_dep/osdep_service.c
> index a00f9f0c85c5..be46132a533a 100644
> --- a/drivers/staging/rtl8723bs/os_dep/osdep_service.c
> +++ b/drivers/staging/rtl8723bs/os_dep/osdep_service.c
> @@ -24,12 +24,7 @@ void *_rtw_malloc(u32 sz)
>
> void *_rtw_zmalloc(u32 sz)
> {
> - void *pbuf = _rtw_malloc(sz);
> -
> - if (pbuf)
> - memset(pbuf, 0, sz);
> -
> - return pbuf;
> + return kzalloc(sz, in_interrupt() ? GFP_ATOMIC : GFP_KERNEL);
This in_interrupt() is garbage. We should use GFP_ATOMIC if we
are in an interrupt handler or if holding a spinlock. The right
thing to do is review all the callers and figure out whether
GFP_ATOMIC or GFP_KERNEL is appropriate.
regards,
dan carpenter
Powered by blists - more mailing lists