Linux kernel staging patches
 help / color / mirror / Atom feed
* [PATCH] staging: rtl8723bs: remove unnecessary NULL check before vfree
@ 2026-05-28  6:57 Bastien Cossette
  2026-05-28  7:02 ` Dan Carpenter
  2026-05-28  7:25 ` Greg Kroah-Hartman
  0 siblings, 2 replies; 3+ messages in thread
From: Bastien Cossette @ 2026-05-28  6:57 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-staging, Bastien Cossette

The vfree() function handles NULL pointers natively. Cleaning up the
redundant if check simplifies the code and adheres to core kernel
coding styles.

Signed-off-by: Bastien Cossette <bastiencossette29@icloud.com>
---
 drivers/staging/rtl8723bs/hal/hal_com.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/rtl8723bs/hal/hal_com.c b/drivers/staging/rtl8723bs/hal/hal_com.c
index 728a2171fbcb..24dfae2dd759 100644
--- a/drivers/staging/rtl8723bs/hal/hal_com.c
+++ b/drivers/staging/rtl8723bs/hal/hal_com.c
@@ -23,14 +23,10 @@ u8 rtw_hal_data_init(struct adapter *padapter)
 
 void rtw_hal_data_deinit(struct adapter *padapter)
 {
-	if (padapter->HalData) {
-		vfree(padapter->HalData);
-		padapter->HalData = NULL;
-		padapter->hal_data_sz = 0;
-	}
+	vfree(padapter->HalData);
+	padapter->hal_data_sz = 0;
 }
 
-
 void dump_chip_info(struct hal_version	chip_version)
 {
 	char buf[128];
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] staging: rtl8723bs: remove unnecessary NULL check before vfree
  2026-05-28  6:57 [PATCH] staging: rtl8723bs: remove unnecessary NULL check before vfree Bastien Cossette
@ 2026-05-28  7:02 ` Dan Carpenter
  2026-05-28  7:25 ` Greg Kroah-Hartman
  1 sibling, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2026-05-28  7:02 UTC (permalink / raw)
  To: Bastien Cossette; +Cc: Greg Kroah-Hartman, linux-staging

On Thu, May 28, 2026 at 02:57:23AM -0400, Bastien Cossette wrote:
> The vfree() function handles NULL pointers natively. Cleaning up the
> redundant if check simplifies the code and adheres to core kernel
> coding styles.
> 
> Signed-off-by: Bastien Cossette <bastiencossette29@icloud.com>
> ---
>  drivers/staging/rtl8723bs/hal/hal_com.c | 8 ++------
>  1 file changed, 2 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/staging/rtl8723bs/hal/hal_com.c b/drivers/staging/rtl8723bs/hal/hal_com.c
> index 728a2171fbcb..24dfae2dd759 100644
> --- a/drivers/staging/rtl8723bs/hal/hal_com.c
> +++ b/drivers/staging/rtl8723bs/hal/hal_com.c
> @@ -23,14 +23,10 @@ u8 rtw_hal_data_init(struct adapter *padapter)
>  
>  void rtw_hal_data_deinit(struct adapter *padapter)
>  {
> -	if (padapter->HalData) {
> -		vfree(padapter->HalData);
> -		padapter->HalData = NULL;
> -		padapter->hal_data_sz = 0;
> -	}
> +	vfree(padapter->HalData);
> +	padapter->hal_data_sz = 0;


You can't delete the "padapter->HalData = NULL;" assignment.

>  }
>  
> -

Do white space changes in their own patch.

regards,
dan carpenter



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] staging: rtl8723bs: remove unnecessary NULL check before vfree
  2026-05-28  6:57 [PATCH] staging: rtl8723bs: remove unnecessary NULL check before vfree Bastien Cossette
  2026-05-28  7:02 ` Dan Carpenter
@ 2026-05-28  7:25 ` Greg Kroah-Hartman
  1 sibling, 0 replies; 3+ messages in thread
From: Greg Kroah-Hartman @ 2026-05-28  7:25 UTC (permalink / raw)
  To: Bastien Cossette; +Cc: linux-staging

On Thu, May 28, 2026 at 02:57:23AM -0400, Bastien Cossette wrote:
> The vfree() function handles NULL pointers natively. Cleaning up the
> redundant if check simplifies the code and adheres to core kernel
> coding styles.
> 
> Signed-off-by: Bastien Cossette <bastiencossette29@icloud.com>
> ---
>  drivers/staging/rtl8723bs/hal/hal_com.c | 8 ++------
>  1 file changed, 2 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/staging/rtl8723bs/hal/hal_com.c b/drivers/staging/rtl8723bs/hal/hal_com.c
> index 728a2171fbcb..24dfae2dd759 100644
> --- a/drivers/staging/rtl8723bs/hal/hal_com.c
> +++ b/drivers/staging/rtl8723bs/hal/hal_com.c
> @@ -23,14 +23,10 @@ u8 rtw_hal_data_init(struct adapter *padapter)
>  
>  void rtw_hal_data_deinit(struct adapter *padapter)
>  {
> -	if (padapter->HalData) {
> -		vfree(padapter->HalData);
> -		padapter->HalData = NULL;
> -		padapter->hal_data_sz = 0;
> -	}
> +	vfree(padapter->HalData);
> +	padapter->hal_data_sz = 0;

What about setting HalData to NULL?  Is other code relying on that?

>  }
>  
> -

This change is not relevant for the other one :(

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-05-28  7:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-28  6:57 [PATCH] staging: rtl8723bs: remove unnecessary NULL check before vfree Bastien Cossette
2026-05-28  7:02 ` Dan Carpenter
2026-05-28  7:25 ` Greg Kroah-Hartman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox