Re: [PATCH] staging: rtl8723bs: core: Using comparison to true is error prone

From: Gustavo A. R. Silva
Date: Fri Jul 10 2020 - 17:01:39 EST




On 7/10/20 15:16, John Oldman wrote:
> clear below issues reported by checkpatch.pl:
>
> CHECK: Using comparison to true is error prone
>
> Signed-off-by: John Oldman <john.oldman@xxxxxxxxxxxxxx>
> ---
> drivers/staging/rtl8723bs/core/rtw_ieee80211.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/staging/rtl8723bs/core/rtw_ieee80211.c b/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
> index ca98274ae390..d9bdd4fb9dc3 100644
> --- a/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
> +++ b/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
> @@ -363,8 +363,9 @@ int rtw_generate_ie(struct registry_priv *pregistrypriv)
> }
>
> /* HT Cap. */
> - if (((pregistrypriv->wireless_mode&WIRELESS_11_5N) || (pregistrypriv->wireless_mode&WIRELESS_11_24N))
> - && (pregistrypriv->ht_enable == true)) {
> + if (((pregistrypriv->wireless_mode & WIRELESS_11_5N)
> + || (pregistrypriv->wireless_mode & WIRELESS_11_24N))
> + && (pregistrypriv->ht_enable)) {
^ ^
The enclosing parentheses are unnecessary.

Also, if you run checkpatch.pl on your patch, you'll see
the following:

CHECK: Logical continuations should be on the previous line
#12: FILE: drivers/staging/rtl8723bs/core/rtw_ieee80211.c:367:
+ if (((pregistrypriv->wireless_mode & WIRELESS_11_5N)
+ || (pregistrypriv->wireless_mode & WIRELESS_11_24N))

CHECK: Logical continuations should be on the previous line
#13: FILE: drivers/staging/rtl8723bs/core/rtw_ieee80211.c:368:
+ || (pregistrypriv->wireless_mode & WIRELESS_11_24N))
+ && (pregistrypriv->ht_enable)) {


It'd be nice to fix the above, too. :)

--
Gustavo

> /* todo: */
> }
>
>