lkml.org 
[lkml]   [2022]   [Apr]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH] staging: r8188eu: remove unncessary ternary operator
From
Hi Dan,

On 4/4/22 15:08, Dan Carpenter wrote:
> 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?
>

It has the same issue. I'll leave these two as is in v2.

>> 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.

It turned out that these are all unused and can be removed.
I should really have looked deeper into this, sorry.

I'll remove them in a separate patch in v2.

thanks,
Michael

\
 
 \ /
  Last update: 2022-04-05 00:20    [W:0.064 / U:1.728 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site