Skip to contentSkip to conversation

Remove some dead code in the Renesas Ethernet drivers

PATCH Applied Sergey Shtylyov 4 participants 7 messages Jan 29, 2022 – Feb 2, 2022

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

v2 cover Remove some dead code in the Renesas Ethernet drivers

Here are 2 patches against DaveM's 'net-next.git' repo. The Renesas drivers call their ndo_stop() methods directly and they always return 0, making the result checks pointless, hence remove them...

Sergey Shtylyov (2):
ravb: ravb_close() always returns 0
sh_eth: sh_eth_close() always returns 0

 drivers/net/ethernet/renesas/ravb_main.c | 5 +----
 drivers/net/ethernet/renesas/sh_eth.c    | 4 +---
 2 files changed, 2 insertions(+), 7 deletions(-)
Signature · 1 line
2.26.3
#1 lore raw

PATCH v2 1/2 ravb: ravb_close() always returns 0

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.

---
Changes in version 2:
- removed no longer used local variable in ravb_wol_restore().

 drivers/net/ethernet/renesas/ravb_main.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/net/ethernet/renesas/ravb_main.c +1 -4
index b215cde68e10..9ee246796a77 100644
@@ -2854,7 +2854,6 @@ static int ravb_wol_restore(struct net_device *ndev)
 {
 	struct ravb_private *priv = netdev_priv(ndev);
 	const struct ravb_hw_info *info = priv->info;
-	int ret;
 
 	if (info->nc_queues)
 		napi_enable(&priv->napi[RAVB_NC]);
@@ -2863,9 +2862,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);
 }
Signature · 1 line
2.26.3
Reviewed-by on v2 1/2
#2 lore raw

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

Quoted 8 lines · Sergey Shtylyov

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.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

#3 lore raw

PATCH v2 2/2 sh_eth: sh_eth_close() always returns 0

In reply to Sergey Shtylyov

sh_eth_close() always returns 0, hence the check in sh_eth_wol_restore() is pointless (however we cannot change the prototype of sh_eth_close() as it implements the driver's ndo_stop() method).

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

---
 drivers/net/ethernet/renesas/sh_eth.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/net/ethernet/renesas/sh_eth.c +1 -3
index d947a628e166..b21e101b4484 100644
@@ -3450,9 +3450,7 @@ static int sh_eth_wol_restore(struct net_device *ndev)
 	 * both be reset and all registers restored. This is what
 	 * happens during suspend and resume without WoL enabled.
 	 */
-	ret = sh_eth_close(ndev);
-	if (ret < 0)
-		return ret;
+	sh_eth_close(ndev);
 	ret = sh_eth_open(ndev);
 	if (ret < 0)
 		return ret;
Signature · 1 line
2.26.3
Reviewed-by on v2 2/2
#4 lore raw

Re: [PATCH v2 2/2] sh_eth: sh_eth_close() always returns 0

Hi Sergei,

Quoted 8 lines · Sergey Shtylyov

sh_eth_close() always returns 0, hence the check in sh_eth_wol_restore() is pointless (however we cannot change the prototype of sh_eth_close() as it implements the driver's ndo_stop() method).

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

Thanks for your patch!

Note that there's a second call in sh_eth_suspend().

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

#5 lore raw

Re: [PATCH v2 2/2] sh_eth: sh_eth_close() always returns 0

On 01.02.2022 11:58, Geert Uytterhoeven wrote:

[...]

Quoted 7 lines
Quoted 7 lines

sh_eth_close() always returns 0, hence the check in sh_eth_wol_restore() is pointless (however we cannot change the prototype of sh_eth_close() as it implements the driver's ndo_stop() method).

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

Quoted 7 lines
Quoted 1 line

Thanks for your patch!

Note that there's a second call in sh_eth_suspend().

Made no sense to change it. :-)

Quoted 3 lines

Gr{oetje,eeting}s,

Geert

MBR, Sergey

#6 lore raw
In reply to Sergey Shtylyov
This series was applied to netdev/net-next.git (master) by David S. Miller <[email protected]>:

Hello:

This series was applied to netdev/net-next.git (master) by David S. Miller <[email protected]>:

Quoted 9 lines · On Sat, 29 Jan 2022 14:55:15 +0300 you wrote:

Here are 2 patches against DaveM's 'net-next.git' repo. The Renesas drivers call their ndo_stop() methods directly and they always return 0, making the result checks pointless, hence remove them...

Sergey Shtylyov (2):
ravb: ravb_close() always returns 0
sh_eth: sh_eth_close() always returns 0

[...]

Here is the summary with links:
- [v2,1/2] ravb: ravb_close() always returns 0

    https://git.kernel.org/netdev/net-next/c/be94a51f3e5e
  - [v2,2/2] sh_eth: sh_eth_close() always returns 0
    https://git.kernel.org/netdev/net-next/c/e7d966f9ea52

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html