staging: rtl8192u: remove the if condition without effect
PATCH 1/1 staging: rtl8192u: remove the if condition without effect
In function rtl8192_adapter_start priv->pFirmware->firmware_status is assign to FW_STATUS_0_INIT just after assignment variable is again get check for same value. Therefore if condition will be always be true. So remove the if condition ,else if section and else section which will never get execute.
--- drivers/staging/rtl8192u/r8192U_core.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-)
drivers/staging/rtl8192u/r8192U_core.c +1 -8
@@ -2666,14 +2666,7 @@ static bool rtl8192_adapter_start(struct net_device *dev)/* config CPUReset Register */ /* Firmware Reset or not? */ read_nic_dword (dev,CPU_GEN , &dwRegRead); -if (priv->pFirmware->firmware_status ==FW_STATUS_0_INIT ) - dwRegRead |=CPU_GEN_SYSTEM_RESET ;/* do nothing here? */ -else if (priv->pFirmware->firmware_status ==FW_STATUS_5_READY ) - dwRegRead |=CPU_GEN_FIRMWARE_RESET ; -else -RT_TRACE (COMP_ERR , -"ERROR in %s(): undefined firmware state(%d)\n" , - __func__, priv->pFirmware->firmware_status); + dwRegRead |=CPU_GEN_SYSTEM_RESET ;/* do nothing here? */ write_nic_dword (dev,CPU_GEN , dwRegRead);/* config BB. */
--
2.33.0
Quoted 32 lines · Saurav Girepunje
In function
rtl8192_adapter_startpriv->pFirmware->firmware_statusis assign toFW_STATUS_0_INITjust after assignment variable is again get check for same value. Therefore if condition will be always be true. So remove the if condition ,else if section and else section which will never get execute.Signed-off-by Saurav Girepunje <[email protected]>--- drivers/staging/rtl8192u/r8192U_core.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-)drivers/staging/rtl8192u/r8192U_core.c +1
-9@@ -2666,14 +2666,7 @@ static bool rtl8192_adapter_start(struct net_device *dev)/* config CPUReset Register */ /* Firmware Reset or not? */ read_nic_dword (dev,CPU_GEN , &dwRegRead); -if (priv->pFirmware->firmware_status ==FW_STATUS_0_INIT ) - dwRegRead |=CPU_GEN_SYSTEM_RESET ;/* do nothing here? */ -else if (priv->pFirmware->firmware_status ==FW_STATUS_5_READY ) - dwRegRead |=CPU_GEN_FIRMWARE_RESET ; -else -RT_TRACE (COMP_ERR , -"ERROR in %s(): undefined firmware state(%d)\n" , - __func__, priv->pFirmware->firmware_status); + dwRegRead |=CPU_GEN_SYSTEM_RESET ;/* do nothing here? */ write_nic_dword (dev,CPU_GEN , dwRegRead);/* config BB. */ --
Quoted 2 lines
2.33.0
read_nic_dword function call also does not update value of priv->pFirmware->firmware_status. read_nic_dword return a value that never check by any caller function.
That can cover on another patch.
Regards,
Saurav