staging: r8188eu: Remove variables and simplify PHY_SwChnl8188E()
authorFabio M. De Francesco <fmdefrancesco@gmail.com>
Fri, 13 Aug 2021 16:08:12 +0000 (18:08 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 16 Aug 2021 07:08:34 +0000 (09:08 +0200)
Remove "bResult" and "tmpchannel" and all tests and assignments that
are related to them in the code of PHY_SwChnl8188E().

"bResult" was always true, therefore its test led to a null statement.
"tmpchannel" was used only to restore "pHalData->CurrentChannel" to its
previous value only if _PHY_SwChnl8192C() was not called; therefore
assign "channel" to "pHalData->CurrentChannel" if and only if
_PHY_SwChnl8192C() is to be executed (and get rid of that temporary
storage).

Acked-by: Phillip Potter <phil@philpotter.co.uk>
Signed-off-by: Fabio M. De Francesco <fmdefrancesco@gmail.com>
Link: https://lore.kernel.org/r/20210813160812.17603-1-fmdefrancesco@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/r8188eu/hal/rtl8188e_phycfg.c

index 02955b8..9af91ec 100644 (file)
@@ -1091,8 +1091,6 @@ void PHY_SwChnl8188E(struct adapter *Adapter, u8 channel)
 {
        /*  Call after initialization */
        struct hal_data_8188e   *pHalData = GET_HAL_DATA(Adapter);
-       u8 tmpchannel = pHalData->CurrentChannel;
-       bool  bResult = true;
 
        if (pHalData->rf_chip == RF_PSEUDO_11N)
                return;         /* return immediately if it is peudo-phy */
@@ -1100,17 +1098,8 @@ void PHY_SwChnl8188E(struct adapter *Adapter, u8 channel)
        if (channel == 0)
                channel = 1;
 
-       pHalData->CurrentChannel = channel;
-
        if ((!Adapter->bDriverStopped) && (!Adapter->bSurpriseRemoved)) {
+               pHalData->CurrentChannel = channel;
                _PHY_SwChnl8192C(Adapter, channel);
-
-               if (bResult)
-                       ;
-               else
-                       pHalData->CurrentChannel = tmpchannel;
-
-       } else {
-               pHalData->CurrentChannel = tmpchannel;
        }
 }