linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] staging: rtl8192u: remove the if condition without effect
@ 2021-11-08  4:11 Saurav Girepunje
  2021-11-08  4:15 ` Saurav Girepunje
  0 siblings, 1 reply; 2+ messages in thread
From: Saurav Girepunje @ 2021-11-08  4:11 UTC (permalink / raw)
  To: gregkh, kuba, lee.jones, saurav.girepunje, nathan, clrrm, johan,
	dinghao.liu, linux-staging, linux-kernel
  Cc: saurav.girepunje

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.

Signed-off-by: Saurav Girepunje <saurav.girepunje@gmail.com>
---
 drivers/staging/rtl8192u/r8192U_core.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c
index 726d7ad9408b..f5d9e81f4ac7 100644
--- a/drivers/staging/rtl8192u/r8192U_core.c
+++ b/drivers/staging/rtl8192u/r8192U_core.c
@@ -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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] staging: rtl8192u: remove the if condition without effect
  2021-11-08  4:11 [PATCH] staging: rtl8192u: remove the if condition without effect Saurav Girepunje
@ 2021-11-08  4:15 ` Saurav Girepunje
  0 siblings, 0 replies; 2+ messages in thread
From: Saurav Girepunje @ 2021-11-08  4:15 UTC (permalink / raw)
  To: gregkh, kuba, lee.jones, nathan, clrrm, johan, dinghao.liu,
	linux-staging, linux-kernel
  Cc: saurav.girepunje



On 08/11/21 9:41 am, Saurav Girepunje wrote:
> 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.
> 
> Signed-off-by: Saurav Girepunje <saurav.girepunje@gmail.com>
> ---
>  drivers/staging/rtl8192u/r8192U_core.c | 9 +--------
>  1 file changed, 1 insertion(+), 8 deletions(-)
> 
> diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c
> index 726d7ad9408b..f5d9e81f4ac7 100644
> --- a/drivers/staging/rtl8192u/r8192U_core.c
> +++ b/drivers/staging/rtl8192u/r8192U_core.c
> @@ -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
> 

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-11-08  4:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-08  4:11 [PATCH] staging: rtl8192u: remove the if condition without effect Saurav Girepunje
2021-11-08  4:15 ` Saurav Girepunje

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