Re: [PATCH] staging: r8188eu: remove unncessary ternary operator

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

 



On Sat, Apr 02, 2022 at 07:38:35PM +0200, Michael Straube wrote:
> diff --git a/drivers/staging/r8188eu/hal/rtl8188e_cmd.c b/drivers/staging/r8188eu/hal/rtl8188e_cmd.c
> index 45b788212628..18650cd96f09 100644
> --- a/drivers/staging/r8188eu/hal/rtl8188e_cmd.c
> +++ b/drivers/staging/r8188eu/hal/rtl8188e_cmd.c
> @@ -137,7 +137,7 @@ void rtl8188e_Add_RateATid(struct adapter *pAdapter, u32 bitmap, u8 arg, u8 rssi
>  
>  	bitmap |= ((raid << 28) & 0xf0000000);
>  
> -	short_gi_rate = (arg & BIT(5)) ? true : false;
> +	short_gi_rate = arg & BIT(5);
>  

This is a bug.  Valid values of short_gi_rate are 0 and 1 but this sets
it to BIT(5) so it will break odm_RateUp_8188E() which tests for:

	else if ((pRaInfo->SGIEnable) != 1)

>  	raid = (bitmap >> 28) & 0x0f;
>  
> diff --git a/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c b/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c
> index 6811be95da9a..ffc82d17ddbe 100644
> --- a/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c
> +++ b/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c
> @@ -747,7 +747,7 @@ void Hal_ReadPowerSavingMode88E(struct adapter *padapter, u8 *hwinfo, bool AutoL
>  
>  		/*  decide hw if support remote wakeup function */
>  		/*  if hw supported, 8051 (SIE) will generate WeakUP signal(D+/D- toggle) when autoresume */
> -		padapter->pwrctrlpriv.bSupportRemoteWakeup = (hwinfo[EEPROM_USB_OPTIONAL_FUNCTION0] & BIT(1)) ? true : false;
> +		padapter->pwrctrlpriv.bSupportRemoteWakeup = hwinfo[EEPROM_USB_OPTIONAL_FUNCTION0] & BIT(1);

I have not looked at this one to see if has a similar issue...  I don't
necessarily want to audit all of these.  I guess I will, but could you
do it first and then I will check?

> diff --git a/drivers/staging/r8188eu/include/ieee80211.h b/drivers/staging/r8188eu/include/ieee80211.h
> index 8c20363cdd31..03d63257797a 100644
> --- a/drivers/staging/r8188eu/include/ieee80211.h
> +++ b/drivers/staging/r8188eu/include/ieee80211.h
> @@ -127,7 +127,7 @@ enum NETWORK_TYPE {
>  	 (WIRELESS_11B | WIRELESS_11G | WIRELESS_11_24N)
>  
>  #define IsSupported24G(NetType)					\
> -	((NetType) & SUPPORTED_24G_NETTYPE_MSK ? true : false)
> +	((NetType) & SUPPORTED_24G_NETTYPE_MSK)

This too.

>  
>  #define IsEnableHWCCK(NetType)					\
>  	IsSupported24G(NetType)
> @@ -135,11 +135,11 @@ enum NETWORK_TYPE {
>  #define IsSupportedRxCCK(NetType) IsEnableHWCCK(NetType)
>  
>  #define IsSupportedTxCCK(NetType)				\
> -	((NetType) & (WIRELESS_11B) ? true : false)
> +	((NetType) & WIRELESS_11B)
>  #define IsSupportedTxOFDM(NetType)				\
> -	((NetType) & (WIRELESS_11G) ? true : false)
> +	((NetType) & WIRELESS_11G)
>  #define IsSupportedTxMCS(NetType)				\
> -	((NetType) & (WIRELESS_11_24N) ? true : false)
> +	((NetType) & WIRELESS_11_24N)
>  

And this.

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