diff mbox series

[1/2] ravb: ravb_close() always returns 0

Message ID 20220128203838.17423-2-s.shtylyov@omp.ru (mailing list archive)
State Superseded
Delegated to: Geert Uytterhoeven
Headers show
Series Kill some dead code in the Renesas Ethernet drivers | expand

Commit Message

Sergey Shtylyov Jan. 28, 2022, 8:38 p.m. UTC
ravb_close() always returns 0, hence the check in ravb_wol_restore() is
pointless (however, we cannot change the prototype of ravb_close() as it
implements the driver's ndo_stop() method).

Found by Linux Verification Center (linuxtesting.org) with the SVACE static
analysis tool.

Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
---
 drivers/net/ethernet/renesas/ravb_main.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

Comments

Jakub Kicinski Jan. 28, 2022, 9:51 p.m. UTC | #1
On Fri, 28 Jan 2022 23:38:37 +0300 Sergey Shtylyov wrote:
> ravb_close() always returns 0, hence the check in ravb_wol_restore() is
> pointless (however, we cannot change the prototype of ravb_close() as it
> implements the driver's ndo_stop() method).
> 
> Found by Linux Verification Center (linuxtesting.org) with the SVACE static
> analysis tool.
> 
> Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
> ---
>  drivers/net/ethernet/renesas/ravb_main.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
> index b215cde68e10..02fa8cfc2b7b 100644
> --- a/drivers/net/ethernet/renesas/ravb_main.c
> +++ b/drivers/net/ethernet/renesas/ravb_main.c
> @@ -2863,9 +2863,7 @@ static int ravb_wol_restore(struct net_device *ndev)
>  	/* Disable MagicPacket */
>  	ravb_modify(ndev, ECMR, ECMR_MPDE, 0);
>  
> -	ret = ravb_close(ndev);
> -	if (ret < 0)
> -		return ret;
> +	ravb_close(ndev);
>  
>  	return disable_irq_wake(priv->emac_irq);
>  }

drivers/net/ethernet/renesas/ravb_main.c:2857:13: warning: unused variable ‘ret’ [-Wunused-variable]
 2857 |         int ret;
      |             ^~~
Sergey Shtylyov Jan. 29, 2022, 10:38 a.m. UTC | #2
Hello!

On 1/29/22 12:51 AM, Jakub Kicinski wrote:

>> ravb_close() always returns 0, hence the check in ravb_wol_restore() is
>> pointless (however, we cannot change the prototype of ravb_close() as it
>> implements the driver's ndo_stop() method).
>>
>> Found by Linux Verification Center (linuxtesting.org) with the SVACE static
>> analysis tool.
>>
>> Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
>> ---
>>  drivers/net/ethernet/renesas/ravb_main.c | 4 +---
>>  1 file changed, 1 insertion(+), 3 deletions(-)
>>
>> diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
>> index b215cde68e10..02fa8cfc2b7b 100644
>> --- a/drivers/net/ethernet/renesas/ravb_main.c
>> +++ b/drivers/net/ethernet/renesas/ravb_main.c
>> @@ -2863,9 +2863,7 @@ static int ravb_wol_restore(struct net_device *ndev)
>>  	/* Disable MagicPacket */
>>  	ravb_modify(ndev, ECMR, ECMR_MPDE, 0);
>>  
>> -	ret = ravb_close(ndev);
>> -	if (ret < 0)
>> -		return ret;
>> +	ravb_close(ndev);
>>  
>>  	return disable_irq_wake(priv->emac_irq);
>>  }
> 
> drivers/net/ethernet/renesas/ravb_main.c:2857:13: warning: unused variable ‘ret’ [-Wunused-variable]
>  2857 |         int ret;
>       |             ^~~

   Oops, sorry about that!
   This patch was created during the merge window and when it finally closed, I rushed
to send this series before the end of week, and forgot to sanity check it (thinking it
has been checked already)... :-/
   I'll fix and resend...

MBR, Sergey
diff mbox series

Patch

diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
index b215cde68e10..02fa8cfc2b7b 100644
--- a/drivers/net/ethernet/renesas/ravb_main.c
+++ b/drivers/net/ethernet/renesas/ravb_main.c
@@ -2863,9 +2863,7 @@  static int ravb_wol_restore(struct net_device *ndev)
 	/* Disable MagicPacket */
 	ravb_modify(ndev, ECMR, ECMR_MPDE, 0);
 
-	ret = ravb_close(ndev);
-	if (ret < 0)
-		return ret;
+	ravb_close(ndev);
 
 	return disable_irq_wake(priv->emac_irq);
 }