Re: [PATCH 1/2] staging: rtl8723bs: fix coding style issues in core:rtw_wlan_util.c
From: Greg KH
Date: Mon Mar 30 2026 - 12:06:47 EST
On Thu, Mar 26, 2026 at 01:42:20AM +0000, Marcos Andrade wrote:
> The 'enable' parameter in Switch_DM_Func() is of type u8. Explicitly
> comparing it to 'true' (which evaluates to 1) is error-prone. If the
> function is ever called with any non-zero value other than 1, the
> condition will evaluate to false, incorrectly clearing the hardware
> register instead of setting it.
>
> Evaluate the condition implicitly to ensure that any non-zero value
> correctly triggers the set operation.
>
> This change also resolves the following check reported by
> checkpatch.pl.
>
> Signed-off-by: Marcos Andrade <marcosandrade95963@xxxxxxxxx>
> ---
> drivers/staging/rtl8723bs/core/rtw_wlan_util.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/staging/rtl8723bs/core/rtw_wlan_util.c b/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
> index 3242978da36c..41868dda3838 100644
> --- a/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
> +++ b/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
> @@ -236,7 +236,7 @@ void Restore_DM_Func_Flag(struct adapter *padapter)
>
> void Switch_DM_Func(struct adapter *padapter, u32 mode, u8 enable)
> {
> - if (enable == true)
> + if (enable)
Why not just fix the parameter to be boolean instead? That is the
correct fix, right?
thanks,
greg k-h