LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Nathan Chancellor <nathan@kernel.org>
To: Nick Desaulniers <ndesaulniers@google.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Phillip Potter <phil@philpotter.co.uk>,
	Larry Finger <Larry.Finger@lwfinger.net>,
	linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org,
	clang-built-linux@googlegroups.com
Subject: Re: [PATCH 3/4] staging: r8188eu: Remove self assignment in get_rx_power_val_by_reg()
Date: Wed, 4 Aug 2021 11:49:43 -0700	[thread overview]
Message-ID: <431e7405-8761-b014-5c30-c68353ef5af9@kernel.org> (raw)
In-Reply-To: <CAKwvOdkehOWitL+o4s2jWiPk0eTmcjrntiw2rLbpiGynTqSfRw@mail.gmail.com>

On 8/4/2021 11:37 AM, 'Nick Desaulniers' via Clang Built Linux wrote:
> On Tue, Aug 3, 2021 at 3:36 PM Nathan Chancellor <nathan@kernel.org> wrote:
>>
>> Clang warns:
>>
>> drivers/staging/r8188eu/hal/rtl8188e_rf6052.c:344:13: warning:
>> explicitly assigning value of variable of type 'u32' (aka 'unsigned
>> int') to itself [-Wself-assign]
>>                          writeVal = writeVal;
>>                          ~~~~~~~~ ^ ~~~~~~~~
>> 1 warning generated.
>>
>> Remove this branch as it is useless.
>>
>> Signed-off-by: Nathan Chancellor <nathan@kernel.org>
>> ---
>>   drivers/staging/r8188eu/hal/rtl8188e_rf6052.c | 2 --
>>   1 file changed, 2 deletions(-)
>>
>> diff --git a/drivers/staging/r8188eu/hal/rtl8188e_rf6052.c b/drivers/staging/r8188eu/hal/rtl8188e_rf6052.c
>> index 335b120ce603..77889dc05858 100644
>> --- a/drivers/staging/r8188eu/hal/rtl8188e_rf6052.c
>> +++ b/drivers/staging/r8188eu/hal/rtl8188e_rf6052.c
>> @@ -340,8 +340,6 @@ static void get_rx_power_val_by_reg(struct adapter *Adapter, u8 Channel,
>>                  /*  This mechanism is only applied when Driver-Highpower-Mechanism is OFF. */
>>                  if (pdmpriv->DynamicTxHighPowerLvl == TxHighPwrLevel_BT1)
>>                          writeVal = writeVal - 0x06060606;
>> -               else if (pdmpriv->DynamicTxHighPowerLvl == TxHighPwrLevel_BT2)
>> -                       writeVal = writeVal;
> 
> Hopefully the author didn't mean to subtract another magic constant
> like they did above. This also eliminates the last use of
> TxHighPwrLevel_BT2, but it's probably ok to keep the define in
> drivers/staging/r8188eu/include/odm.h.

For what it's worth, it seems that the DynamicTxHighPowerLvl member is 
only ever assigned TxHighPwrLevel_Normal so the first if statement is 
probably dead code too but I wanted to clean up the clang warnings, not 
rewrite the driver, since I could do that for hours upon hours :)

> Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>

Thanks for the review!

Cheers,
Nathan

>>                  *(pOutWriteVal+rf) = writeVal;
>>          }
>>   }
>> --
>> 2.33.0.rc0
> 
> 

  reply	other threads:[~2021-08-04 18:49 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-03 22:36 [PATCH 0/4] staging: r8188eu: Fix clang warnings Nathan Chancellor
2021-08-03 22:36 ` [PATCH 1/4] staging: r8188eu: Remove _rtw_spinlock_free() Nathan Chancellor
2021-08-03 22:36 ` [PATCH 2/4] staging: r8188eu: Remove unnecessary parentheses Nathan Chancellor
2021-08-04 17:46   ` Nick Desaulniers
2021-08-04 18:46     ` Nathan Chancellor
2021-08-03 22:36 ` [PATCH 3/4] staging: r8188eu: Remove self assignment in get_rx_power_val_by_reg() Nathan Chancellor
2021-08-04 18:37   ` Nick Desaulniers
2021-08-04 18:49     ` Nathan Chancellor [this message]
2021-08-03 22:36 ` [PATCH 4/4] staging: r8188eu: Remove pointless NULL check in rtw_check_join_candidate() Nathan Chancellor
2021-08-05 11:11 ` [PATCH 0/4] staging: r8188eu: Fix clang warnings Greg Kroah-Hartman
2021-08-05 18:58 ` [PATCH v2 0/3] " Nathan Chancellor
2021-08-05 18:58   ` [PATCH v2 1/3] staging: r8188eu: Remove unnecessary parentheses Nathan Chancellor
2021-08-05 18:58   ` [PATCH v2 2/3] staging: r8188eu: Remove self assignment in get_rx_power_val_by_reg() Nathan Chancellor
2021-08-05 18:58   ` [PATCH v2 3/3] staging: r8188eu: Remove pointless NULL check in rtw_check_join_candidate() Nathan Chancellor
2021-08-05 19:51     ` Nick Desaulniers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=431e7405-8761-b014-5c30-c68353ef5af9@kernel.org \
    --to=nathan@kernel.org \
    --cc=Larry.Finger@lwfinger.net \
    --cc=clang-built-linux@googlegroups.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=ndesaulniers@google.com \
    --cc=phil@philpotter.co.uk \
    --subject='Re: [PATCH 3/4] staging: r8188eu: Remove self assignment in get_rx_power_val_by_reg()' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).