Re: [PATCH 01/15] staging: rtl8723bs: inlcude macros in a do..while loop in core/rtw_security.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Mar 26, 2021 at 10:09:08AM +0100, Fabio Aiuto wrote:
> fix the following checkpatch warning:
> 
> ERROR: Macros starting with if should be enclosed by a do - while
> loop to avoid possible if/else logic defects
> 33: FILE: drivers/staging/rtl8723bs/core/rtw_security.c:33:
> +#define WEP_SW_ENC_CNT_INC(sec, ra) \
> --
> ERROR: Macros starting with if should be enclosed by a do - while
> loop to avoid possible if/else logic defects
> 41: FILE: drivers/staging/rtl8723bs/core/rtw_security.c:41:
> +#define WEP_SW_DEC_CNT_INC(sec, ra) \
> --
> ERROR: Macros starting with if should be enclosed by a do - while
> loop to avoid possible if/else logic defects
> 49: FILE: drivers/staging/rtl8723bs/core/rtw_security.c:49:
> +#define TKIP_SW_ENC_CNT_INC(sec, ra) \
> --
> ERROR: Macros starting with if should be enclosed by a do - while
> loop to avoid possible if/else logic defects
> 57: FILE: drivers/staging/rtl8723bs/core/rtw_security.c:57:
> +#define TKIP_SW_DEC_CNT_INC(sec, ra) \
> --
> ERROR: Macros starting with if should be enclosed by a do - while
> loop to avoid possible if/else logic defects
> 65: FILE: drivers/staging/rtl8723bs/core/rtw_security.c:65:
> +#define AES_SW_ENC_CNT_INC(sec, ra) \
> --
> ERROR: Macros starting with if should be enclosed by a do - while
> loop to avoid possible if/else logic defects
> 73: FILE: drivers/staging/rtl8723bs/core/rtw_security.c:73:
> +#define AES_SW_DEC_CNT_INC(sec, ra) \
> --
> ERROR: Macros with multiple statements should be enclosed in a
> do - while loop
> 2082: FILE: drivers/staging/rtl8723bs/core/rtw_security.c:2082:
> +#define ROUND(i, d, s) \
> 
> Signed-off-by: Fabio Aiuto <fabioaiuto83@xxxxxxxxx>
> ---
>  drivers/staging/rtl8723bs/core/rtw_security.c | 94 +++++++++++--------
>  1 file changed, 54 insertions(+), 40 deletions(-)
> 
> diff --git a/drivers/staging/rtl8723bs/core/rtw_security.c b/drivers/staging/rtl8723bs/core/rtw_security.c
> index 44e2b362c867..c92984fcf42d 100644
> --- a/drivers/staging/rtl8723bs/core/rtw_security.c
> +++ b/drivers/staging/rtl8723bs/core/rtw_security.c
> @@ -31,52 +31,64 @@ const char *security_type_str(u8 value)
>  
>  #ifdef DBG_SW_SEC_CNT
>  #define WEP_SW_ENC_CNT_INC(sec, ra) \
> -	if (is_broadcast_mac_addr(ra)) \
> -		sec->wep_sw_enc_cnt_bc++; \
> -	else if (is_multicast_mac_addr(ra)) \
> -		sec->wep_sw_enc_cnt_mc++; \
> -	else \
> -		sec->wep_sw_enc_cnt_uc++;
> +	do { \
> +		if (is_broadcast_mac_addr(ra)) \
> +			sec->wep_sw_enc_cnt_bc++; \
> +		else if (is_multicast_mac_addr(ra)) \
> +			sec->wep_sw_enc_cnt_mc++; \
> +		else \
> +			sec->wep_sw_enc_cnt_uc++; \
> +	} while (0)

What are these statistics used for?  So far as I can see there not
used at all.  It's probably better to just delete all the
DBG_SW_SEC_CNT code.

regards,
dan carpenter





[Index of Archives]     [Linux Driver Development]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux