netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next 00/54] net: ethernet: Convert to platform remove callback returning void
@ 2023-09-18 20:41 Uwe Kleine-König
  2023-09-18 20:41 ` [PATCH net-next 01/54] net: ethernet: 8390: " Uwe Kleine-König
                   ` (54 more replies)
  0 siblings, 55 replies; 70+ messages in thread
From: Uwe Kleine-König @ 2023-09-18 20:41 UTC (permalink / raw)
  To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: Grygorii Strashko, linux-omap, Bagas Sanjaya, Yang Yingliang,
	Greg Ungerer, Arnd Bergmann, netdev, kernel, Andreas Färber,
	Manivannan Sadhasivam, linux-arm-kernel, linux-actions,
	Andreas Larsson, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland,
	linux-sunxi, Joyce Ooi, Shyam Sundar S K, Bhupesh Sharma,
	Alex Elder, Wei Fang, Rob Herring, Iyappan Subramanian,
	Keyur Chudgar, Quan Nguyen, Atul Raut, Heiko Stuebner,
	Simon Horman, linux-rockchip, Chris Snook, Justin Chen,
	Florian Fainelli, Rafał Miłecki,
	Broadcom internal kernel review list, Doug Berger, Li Zetao,
	Steen Hegelund, Lukas Bulwahn, Nicolas Ferre, Claudiu Beznea,
	Russell King, Marc Kleine-Budde, Hartley Sweeten, Ruan Jinjie,
	Hans Ulli Kroll, Linus Walleij, Kalle Valo, Nathan Huckleberry,
	Gerhard Engleder, Maciej Fijalkowski, Alexander Duyck,
	Paul Fertser, Sergei Antonov, Vladimir Oltean, Yisen Zhuang,
	Salil Mehta, Thomas Bogendoerfer, Michal Kubiak, Douglas Miller,
	Nathan Chancellor, Yuanjun Gong, Zhang Changzhong, Hauke Mehrtens,
	Karol Gugala, Mateusz Holenko, Gabriel Somlo, Joel Stanley,
	Sebastian Hesselbarth, Thomas Petazzoni, Marcin Wojtas,
	Michael Walle, Andrew Lunn, Russell King (Oracle),
	Krzysztof Kozlowski, Felix Fietkau, John Crispin, Sean Wang,
	Mark Lee, Lorenzo Bianconi, Matthias Brugger,
	AngeloGioacchino Del Regno, linux-mediatek, Asmaa Mnebhi,
	David Thompson, Horatiu Vultur, UNGLinuxDriver, Lars Povlsen,
	Daniel Machon, Shang XiaoJing, Qiheng Lin, Claudiu Manoil,
	Alexandre Belloni, Yuri Karpov, Vladimir Zapolskiy, Timur Tabi,
	Sergey Shtylyov, Geert Uytterhoeven, Yoshihiro Shimoda,
	Wolfram Sang, Biju Das, linux-renesas-soc, Byungho An,
	Ralf Baechle, linux-mips, Nicolas Pitre, Steve Glendinning,
	Andy Shevchenko, Jassi Brar, Ilias Apalodimas, Kunihiko Hayashi,
	Harshit Mogalapalli, Wells Lu, Florian Fainelli, Thomas Gleixner,
	Sebastian Andrzej Siewior, Zhengchao Shao, Kevin Brace,
	Francois Romieu, Michal Simek, Radhey Shyam Pandey,
	Harini Katakam, Haoyue Xu, huangjunxian, Dan Carpenter,
	Krzysztof Halasa

Hello,

this series convert nearly all platform drivers below
drivers/net/ethernet to use remove_new. The motivation is to get rid of
an integer return code that is (mostly) ignored by the platform driver
core and error prone on the driver side.

There are 3 drivers I didn't convert (yet):

 drivers/net/ethernet/ti/cpsw.c
 drivers/net/ethernet/ti/cpsw_new.c
 drivers/net/ethernet/ti/am65-cpsw-nuss.c

These are a bit more complicated because they don't always return 0 in
.remove(). Unless someone is quicker than me, I'll address them in
separate patches at a later time.

See commit 5c5a7680e67b ("platform: Provide a remove callback that
returns no value") for an extended explanation and the eventual goal.

There are no interdependencies between the patches. As there are still
quite a few drivers to convert, I'm happy about every patch that makes
it in. So even if there is a merge conflict with one patch until you
apply, please apply the remainder of this series anyhow.

Best regards
Uwe

Uwe Kleine-König (54):
  net: ethernet: 8390: Convert to platform remove callback returning
    void
  net: ethernet: actions: Convert to platform remove callback returning
    void
  net: ethernet: aeroflex: Convert to platform remove callback returning
    void
  net: ethernet: allwinner: Convert to platform remove callback
    returning void
  net: ethernet: altera: Convert to platform remove callback returning
    void
  net: ethernet: amd: Convert to platform remove callback returning void
  net: ethernet: apm: Convert to platform remove callback returning void
  net: ethernet: apple: Convert to platform remove callback returning
    void
  net: ethernet: arc: Convert to platform remove callback returning void
  net: ethernet: atheros: Convert to platform remove callback returning
    void
  net: ethernet: broadcom: Convert to platform remove callback returning
    void
  net: ethernet: cadence: Convert to platform remove callback returning
    void
  net: ethernet: calxeda: Convert to platform remove callback returning
    void
  net: ethernet: cavium: Convert to platform remove callback returning
    void
  net: ethernet: cirrus: Convert to platform remove callback returning
    void
  net: ethernet: cortina: Convert to platform remove callback returning
    void
  net: ethernet: davicom: Convert to platform remove callback returning
    void
  net: ethernet: dnet: Convert to platform remove callback returning
    void
  net: ethernet: engleder: Convert to platform remove callback returning
    void
  net: ethernet: ethoc: Convert to platform remove callback returning
    void
  net: ethernet: faraday: Convert to platform remove callback returning
    void
  net: ethernet: hisilicon: Convert to platform remove callback
    returning void
  net: ethernet: i825xx: Convert to platform remove callback returning
    void
  net: ethernet: ibm: Convert to platform remove callback returning void
  net: ethernet: korina: Convert to platform remove callback returning
    void
  net: ethernet: lantiq_etop: Convert to platform remove callback
    returning void
  net: ethernet: lantiq_xrx200: Convert to platform remove callback
    returning void
  net: ethernet: litex: Convert to platform remove callback returning
    void
  net: ethernet: marvell: Convert to platform remove callback returning
    void
  net: ethernet: mediatek: Convert to platform remove callback returning
    void
  net: ethernet: mellanox: Convert to platform remove callback returning
    void
  net: ethernet: micrel: Convert to platform remove callback returning
    void
  net: ethernet: microchip: Convert to platform remove callback
    returning void
  net: ethernet: moxa:: Convert to platform remove callback returning
    void
  net: ethernet: mscc: Convert to platform remove callback returning
    void
  net: ethernet: natsemi: Convert to platform remove callback returning
    void
  net: ethernet: natsemi: Convert to platform remove callback returning
    void
  net: ethernet: ni: Convert to platform remove callback returning void
  net: ethernet: nxp: Convert to platform remove callback returning void
  net: ethernet: qualcomm: Convert to platform remove callback returning
    void
  net: ethernet: renesas: Convert to platform remove callback returning
    void
  net: ethernet: samsung: Convert to platform remove callback returning
    void
  net: ethernet: seeq: Convert to platform remove callback returning
    void
  net: ethernet: sgi: Convert to platform remove callback returning void
  net: ethernet: smsc: Convert to platform remove callback returning
    void
  net: ethernet: socionext: Convert to platform remove callback
    returning void
  net: ethernet: sun: Convert to platform remove callback returning void
  net: ethernet: sunplus: Convert to platform remove callback returning
    void
  net: ethernet: ti: Convert to platform remove callback returning void
  net: ethernet: tundra: Convert to platform remove callback returning
    void
  net: ethernet: via: Convert to platform remove callback returning void
  net: ethernet: wiznet: Convert to platform remove callback returning
    void
  net: ethernet: xilinx: Convert to platform remove callback returning
    void
  net: ethernet: xscale: Convert to platform remove callback returning
    void

 drivers/net/ethernet/8390/ax88796.c                  |  6 ++----
 drivers/net/ethernet/8390/mcf8390.c                  |  5 ++---
 drivers/net/ethernet/8390/ne.c                       |  5 ++---
 drivers/net/ethernet/actions/owl-emac.c              |  6 ++----
 drivers/net/ethernet/aeroflex/greth.c                |  6 ++----
 drivers/net/ethernet/allwinner/sun4i-emac.c          |  5 ++---
 drivers/net/ethernet/altera/altera_tse_main.c        |  6 ++----
 drivers/net/ethernet/amd/au1000_eth.c                |  6 ++----
 drivers/net/ethernet/amd/sunlance.c                  |  6 ++----
 drivers/net/ethernet/amd/xgbe/xgbe-platform.c        |  6 ++----
 drivers/net/ethernet/apm/xgene-v2/main.c             |  6 ++----
 drivers/net/ethernet/apm/xgene/xgene_enet_main.c     |  6 ++----
 drivers/net/ethernet/apple/macmace.c                 |  6 ++----
 drivers/net/ethernet/arc/emac_arc.c                  |  6 ++----
 drivers/net/ethernet/arc/emac_rockchip.c             |  5 ++---
 drivers/net/ethernet/atheros/ag71xx.c                |  8 +++-----
 drivers/net/ethernet/broadcom/asp2/bcmasp.c          |  8 +++-----
 drivers/net/ethernet/broadcom/bcm4908_enet.c         |  6 ++----
 drivers/net/ethernet/broadcom/bcm63xx_enet.c         | 10 ++++------
 drivers/net/ethernet/broadcom/bcmsysport.c           |  6 ++----
 drivers/net/ethernet/broadcom/bgmac-platform.c       |  6 ++----
 drivers/net/ethernet/broadcom/genet/bcmgenet.c       |  6 ++----
 drivers/net/ethernet/broadcom/sb1250-mac.c           |  6 ++----
 drivers/net/ethernet/cadence/macb_main.c             |  6 ++----
 drivers/net/ethernet/calxeda/xgmac.c                 |  6 ++----
 drivers/net/ethernet/cavium/octeon/octeon_mgmt.c     |  5 ++---
 drivers/net/ethernet/cirrus/cs89x0.c                 |  5 ++---
 drivers/net/ethernet/cirrus/ep93xx_eth.c             |  8 +++-----
 drivers/net/ethernet/cirrus/mac89x0.c                |  5 ++---
 drivers/net/ethernet/cortina/gemini.c                | 12 ++++--------
 drivers/net/ethernet/davicom/dm9000.c                |  6 ++----
 drivers/net/ethernet/dnet.c                          |  6 ++----
 drivers/net/ethernet/engleder/tsnep_main.c           |  6 ++----
 drivers/net/ethernet/ethoc.c                         |  6 ++----
 drivers/net/ethernet/faraday/ftgmac100.c             |  5 ++---
 drivers/net/ethernet/faraday/ftmac100.c              |  5 ++---
 drivers/net/ethernet/hisilicon/hip04_eth.c           |  6 ++----
 drivers/net/ethernet/hisilicon/hisi_femac.c          |  6 ++----
 drivers/net/ethernet/hisilicon/hix5hd2_gmac.c        |  6 ++----
 drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c   |  6 ++----
 drivers/net/ethernet/hisilicon/hns/hns_enet.c        |  5 ++---
 drivers/net/ethernet/hisilicon/hns_mdio.c            |  5 ++---
 drivers/net/ethernet/i825xx/sni_82596.c              |  5 ++---
 drivers/net/ethernet/ibm/ehea/ehea_main.c            |  8 +++-----
 drivers/net/ethernet/ibm/emac/core.c                 |  6 ++----
 drivers/net/ethernet/ibm/emac/mal.c                  |  6 ++----
 drivers/net/ethernet/ibm/emac/rgmii.c                |  6 ++----
 drivers/net/ethernet/ibm/emac/tah.c                  |  6 ++----
 drivers/net/ethernet/ibm/emac/zmii.c                 |  6 ++----
 drivers/net/ethernet/korina.c                        |  6 ++----
 drivers/net/ethernet/lantiq_etop.c                   |  6 ++----
 drivers/net/ethernet/lantiq_xrx200.c                 |  6 ++----
 drivers/net/ethernet/litex/litex_liteeth.c           |  6 ++----
 drivers/net/ethernet/marvell/mv643xx_eth.c           | 11 ++++-------
 drivers/net/ethernet/marvell/mvmdio.c                |  6 ++----
 drivers/net/ethernet/marvell/mvneta.c                |  6 ++----
 drivers/net/ethernet/marvell/mvneta_bm.c             |  6 ++----
 drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c      |  8 +++-----
 drivers/net/ethernet/marvell/pxa168_eth.c            |  5 ++---
 drivers/net/ethernet/mediatek/mtk_eth_soc.c          |  6 ++----
 .../ethernet/mellanox/mlxbf_gige/mlxbf_gige_main.c   |  6 ++----
 drivers/net/ethernet/micrel/ks8842.c                 |  5 ++---
 drivers/net/ethernet/micrel/ks8851_par.c             |  6 ++----
 .../net/ethernet/microchip/lan966x/lan966x_main.c    |  6 ++----
 drivers/net/ethernet/microchip/sparx5/sparx5_main.c  |  6 ++----
 drivers/net/ethernet/moxa/moxart_ether.c             |  6 ++----
 drivers/net/ethernet/mscc/ocelot_vsc7514.c           |  6 ++----
 drivers/net/ethernet/natsemi/jazzsonic.c             |  6 ++----
 drivers/net/ethernet/natsemi/macsonic.c              |  6 ++----
 drivers/net/ethernet/natsemi/xtsonic.c               |  6 ++----
 drivers/net/ethernet/ni/nixge.c                      |  6 ++----
 drivers/net/ethernet/nxp/lpc_eth.c                   |  6 ++----
 drivers/net/ethernet/qualcomm/emac/emac.c            |  6 ++----
 drivers/net/ethernet/renesas/ravb_main.c             |  6 ++----
 drivers/net/ethernet/renesas/rswitch.c               |  6 ++----
 drivers/net/ethernet/renesas/sh_eth.c                |  6 ++----
 drivers/net/ethernet/samsung/sxgbe/sxgbe_platform.c  |  6 ++----
 drivers/net/ethernet/seeq/sgiseeq.c                  |  6 ++----
 drivers/net/ethernet/sgi/ioc3-eth.c                  |  6 ++----
 drivers/net/ethernet/sgi/meth.c                      |  6 ++----
 drivers/net/ethernet/smsc/smc91x.c                   |  6 ++----
 drivers/net/ethernet/smsc/smsc911x.c                 |  6 ++----
 drivers/net/ethernet/socionext/netsec.c              |  6 ++----
 drivers/net/ethernet/socionext/sni_ave.c             |  6 ++----
 drivers/net/ethernet/sun/niu.c                       |  5 ++---
 drivers/net/ethernet/sun/sunbmac.c                   |  6 ++----
 drivers/net/ethernet/sun/sunqe.c                     |  6 ++----
 drivers/net/ethernet/sunplus/spl2sw_driver.c         |  6 ++----
 drivers/net/ethernet/ti/cpmac.c                      |  6 ++----
 drivers/net/ethernet/ti/davinci_emac.c               |  6 ++----
 drivers/net/ethernet/ti/davinci_mdio.c               |  6 ++----
 drivers/net/ethernet/ti/netcp_core.c                 |  5 ++---
 drivers/net/ethernet/tundra/tsi108_eth.c             |  6 ++----
 drivers/net/ethernet/via/via-rhine.c                 |  6 ++----
 drivers/net/ethernet/via/via-velocity.c              |  6 ++----
 drivers/net/ethernet/wiznet/w5100.c                  |  6 ++----
 drivers/net/ethernet/wiznet/w5300.c                  |  5 ++---
 drivers/net/ethernet/xilinx/ll_temac_main.c          |  5 ++---
 drivers/net/ethernet/xilinx/xilinx_axienet_main.c    |  6 ++----
 drivers/net/ethernet/xilinx/xilinx_emaclite.c        |  6 ++----
 drivers/net/ethernet/xscale/ixp4xx_eth.c             |  5 ++---
 101 files changed, 213 insertions(+), 399 deletions(-)


base-commit: 7fc7222d9680366edeecc219c21ca96310bdbc10
-- 
2.40.1


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

* [PATCH net-next 01/54] net: ethernet: 8390: Convert to platform remove callback returning void
  2023-09-18 20:41 [PATCH net-next 00/54] net: ethernet: Convert to platform remove callback returning void Uwe Kleine-König
@ 2023-09-18 20:41 ` Uwe Kleine-König
  2023-09-18 20:41 ` [PATCH net-next 02/54] net: ethernet: actions: " Uwe Kleine-König
                   ` (53 subsequent siblings)
  54 siblings, 0 replies; 70+ messages in thread
From: Uwe Kleine-König @ 2023-09-18 20:41 UTC (permalink / raw)
  To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: Bagas Sanjaya, Yang Yingliang, Greg Ungerer, Arnd Bergmann,
	netdev, kernel

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.
To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new() which already returns void. Eventually after all drivers
are converted, .remove_new() is renamed to .remove().

Trivially convert these drivers from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/net/ethernet/8390/ax88796.c | 6 ++----
 drivers/net/ethernet/8390/mcf8390.c | 5 ++---
 drivers/net/ethernet/8390/ne.c      | 5 ++---
 3 files changed, 6 insertions(+), 10 deletions(-)

diff --git a/drivers/net/ethernet/8390/ax88796.c b/drivers/net/ethernet/8390/ax88796.c
index af603256b724..2874680ef24d 100644
--- a/drivers/net/ethernet/8390/ax88796.c
+++ b/drivers/net/ethernet/8390/ax88796.c
@@ -811,7 +811,7 @@ static int ax_init_dev(struct net_device *dev)
 	return ret;
 }
 
-static int ax_remove(struct platform_device *pdev)
+static void ax_remove(struct platform_device *pdev)
 {
 	struct net_device *dev = platform_get_drvdata(pdev);
 	struct ei_device *ei_local = netdev_priv(dev);
@@ -832,8 +832,6 @@ static int ax_remove(struct platform_device *pdev)
 
 	platform_set_drvdata(pdev, NULL);
 	free_netdev(dev);
-
-	return 0;
 }
 
 /*
@@ -1011,7 +1009,7 @@ static struct platform_driver axdrv = {
 		.name		= "ax88796",
 	},
 	.probe		= ax_probe,
-	.remove		= ax_remove,
+	.remove_new	= ax_remove,
 	.suspend	= ax_suspend,
 	.resume		= ax_resume,
 };
diff --git a/drivers/net/ethernet/8390/mcf8390.c b/drivers/net/ethernet/8390/mcf8390.c
index 217838b28220..5a0fa995e643 100644
--- a/drivers/net/ethernet/8390/mcf8390.c
+++ b/drivers/net/ethernet/8390/mcf8390.c
@@ -441,7 +441,7 @@ static int mcf8390_probe(struct platform_device *pdev)
 	return 0;
 }
 
-static int mcf8390_remove(struct platform_device *pdev)
+static void mcf8390_remove(struct platform_device *pdev)
 {
 	struct net_device *dev = platform_get_drvdata(pdev);
 	struct resource *mem;
@@ -450,7 +450,6 @@ static int mcf8390_remove(struct platform_device *pdev)
 	mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	release_mem_region(mem->start, resource_size(mem));
 	free_netdev(dev);
-	return 0;
 }
 
 static struct platform_driver mcf8390_drv = {
@@ -458,7 +457,7 @@ static struct platform_driver mcf8390_drv = {
 		.name	= "mcf8390",
 	},
 	.probe		= mcf8390_probe,
-	.remove		= mcf8390_remove,
+	.remove_new	= mcf8390_remove,
 };
 
 module_platform_driver(mcf8390_drv);
diff --git a/drivers/net/ethernet/8390/ne.c b/drivers/net/ethernet/8390/ne.c
index 7d89ec1cf273..350683a09d2e 100644
--- a/drivers/net/ethernet/8390/ne.c
+++ b/drivers/net/ethernet/8390/ne.c
@@ -823,7 +823,7 @@ static int __init ne_drv_probe(struct platform_device *pdev)
 	return 0;
 }
 
-static int ne_drv_remove(struct platform_device *pdev)
+static void ne_drv_remove(struct platform_device *pdev)
 {
 	struct net_device *dev = platform_get_drvdata(pdev);
 
@@ -842,7 +842,6 @@ static int ne_drv_remove(struct platform_device *pdev)
 		release_region(dev->base_addr, NE_IO_EXTENT);
 		free_netdev(dev);
 	}
-	return 0;
 }
 
 /* Remove unused devices or all if true. */
@@ -895,7 +894,7 @@ static int ne_drv_resume(struct platform_device *pdev)
 #endif
 
 static struct platform_driver ne_driver = {
-	.remove		= ne_drv_remove,
+	.remove_new	= ne_drv_remove,
 	.suspend	= ne_drv_suspend,
 	.resume		= ne_drv_resume,
 	.driver		= {
-- 
2.40.1


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

* [PATCH net-next 02/54] net: ethernet: actions: Convert to platform remove callback returning void
  2023-09-18 20:41 [PATCH net-next 00/54] net: ethernet: Convert to platform remove callback returning void Uwe Kleine-König
  2023-09-18 20:41 ` [PATCH net-next 01/54] net: ethernet: 8390: " Uwe Kleine-König
@ 2023-09-18 20:41 ` Uwe Kleine-König
  2023-09-18 20:41 ` [PATCH net-next 03/54] net: ethernet: aeroflex: " Uwe Kleine-König
                   ` (52 subsequent siblings)
  54 siblings, 0 replies; 70+ messages in thread
From: Uwe Kleine-König @ 2023-09-18 20:41 UTC (permalink / raw)
  To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: Andreas Färber, Manivannan Sadhasivam, netdev,
	linux-arm-kernel, linux-actions, kernel

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.
To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new() which already returns void. Eventually after all drivers
are converted, .remove_new() is renamed to .remove().

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/net/ethernet/actions/owl-emac.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/actions/owl-emac.c b/drivers/net/ethernet/actions/owl-emac.c
index c6f8f852bff1..e03193da5874 100644
--- a/drivers/net/ethernet/actions/owl-emac.c
+++ b/drivers/net/ethernet/actions/owl-emac.c
@@ -1582,15 +1582,13 @@ static int owl_emac_probe(struct platform_device *pdev)
 	return 0;
 }
 
-static int owl_emac_remove(struct platform_device *pdev)
+static void owl_emac_remove(struct platform_device *pdev)
 {
 	struct owl_emac_priv *priv = platform_get_drvdata(pdev);
 
 	netif_napi_del(&priv->napi);
 	phy_disconnect(priv->netdev->phydev);
 	cancel_work_sync(&priv->mac_reset_task);
-
-	return 0;
 }
 
 static const struct of_device_id owl_emac_of_match[] = {
@@ -1609,7 +1607,7 @@ static struct platform_driver owl_emac_driver = {
 		.pm = &owl_emac_pm_ops,
 	},
 	.probe = owl_emac_probe,
-	.remove = owl_emac_remove,
+	.remove_new = owl_emac_remove,
 };
 module_platform_driver(owl_emac_driver);
 
-- 
2.40.1


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

* [PATCH net-next 03/54] net: ethernet: aeroflex: Convert to platform remove callback returning void
  2023-09-18 20:41 [PATCH net-next 00/54] net: ethernet: Convert to platform remove callback returning void Uwe Kleine-König
  2023-09-18 20:41 ` [PATCH net-next 01/54] net: ethernet: 8390: " Uwe Kleine-König
  2023-09-18 20:41 ` [PATCH net-next 02/54] net: ethernet: actions: " Uwe Kleine-König
@ 2023-09-18 20:41 ` Uwe Kleine-König
  2023-09-18 20:41 ` [PATCH net-next 04/54] net: ethernet: allwinner: " Uwe Kleine-König
                   ` (51 subsequent siblings)
  54 siblings, 0 replies; 70+ messages in thread
From: Uwe Kleine-König @ 2023-09-18 20:41 UTC (permalink / raw)
  To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: Andreas Larsson, netdev, kernel

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.
To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new() which already returns void. Eventually after all drivers
are converted, .remove_new() is renamed to .remove().

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/net/ethernet/aeroflex/greth.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/aeroflex/greth.c b/drivers/net/ethernet/aeroflex/greth.c
index 597a02c75d52..27af7746d645 100644
--- a/drivers/net/ethernet/aeroflex/greth.c
+++ b/drivers/net/ethernet/aeroflex/greth.c
@@ -1525,7 +1525,7 @@ static int greth_of_probe(struct platform_device *ofdev)
 	return err;
 }
 
-static int greth_of_remove(struct platform_device *of_dev)
+static void greth_of_remove(struct platform_device *of_dev)
 {
 	struct net_device *ndev = platform_get_drvdata(of_dev);
 	struct greth_private *greth = netdev_priv(ndev);
@@ -1544,8 +1544,6 @@ static int greth_of_remove(struct platform_device *of_dev)
 	of_iounmap(&of_dev->resource[0], greth->regs, resource_size(&of_dev->resource[0]));
 
 	free_netdev(ndev);
-
-	return 0;
 }
 
 static const struct of_device_id greth_of_match[] = {
@@ -1566,7 +1564,7 @@ static struct platform_driver greth_of_driver = {
 		.of_match_table = greth_of_match,
 	},
 	.probe = greth_of_probe,
-	.remove = greth_of_remove,
+	.remove_new = greth_of_remove,
 };
 
 module_platform_driver(greth_of_driver);
-- 
2.40.1


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

* [PATCH net-next 04/54] net: ethernet: allwinner: Convert to platform remove callback returning void
  2023-09-18 20:41 [PATCH net-next 00/54] net: ethernet: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (2 preceding siblings ...)
  2023-09-18 20:41 ` [PATCH net-next 03/54] net: ethernet: aeroflex: " Uwe Kleine-König
@ 2023-09-18 20:41 ` Uwe Kleine-König
  2023-09-19 17:22   ` Jernej Škrabec
  2023-09-18 20:41 ` [PATCH net-next 05/54] net: ethernet: altera: " Uwe Kleine-König
                   ` (50 subsequent siblings)
  54 siblings, 1 reply; 70+ messages in thread
From: Uwe Kleine-König @ 2023-09-18 20:41 UTC (permalink / raw)
  To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, netdev,
	linux-arm-kernel, linux-sunxi, kernel

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.
To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new() which already returns void. Eventually after all drivers
are converted, .remove_new() is renamed to .remove().

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/net/ethernet/allwinner/sun4i-emac.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/allwinner/sun4i-emac.c b/drivers/net/ethernet/allwinner/sun4i-emac.c
index a94c62956eed..d761c08fe5c1 100644
--- a/drivers/net/ethernet/allwinner/sun4i-emac.c
+++ b/drivers/net/ethernet/allwinner/sun4i-emac.c
@@ -1083,7 +1083,7 @@ static int emac_probe(struct platform_device *pdev)
 	return ret;
 }
 
-static int emac_remove(struct platform_device *pdev)
+static void emac_remove(struct platform_device *pdev)
 {
 	struct net_device *ndev = platform_get_drvdata(pdev);
 	struct emac_board_info *db = netdev_priv(ndev);
@@ -1101,7 +1101,6 @@ static int emac_remove(struct platform_device *pdev)
 	free_netdev(ndev);
 
 	dev_dbg(&pdev->dev, "released and freed device\n");
-	return 0;
 }
 
 static int emac_suspend(struct platform_device *dev, pm_message_t state)
@@ -1143,7 +1142,7 @@ static struct platform_driver emac_driver = {
 		.of_match_table = emac_of_match,
 	},
 	.probe = emac_probe,
-	.remove = emac_remove,
+	.remove_new = emac_remove,
 	.suspend = emac_suspend,
 	.resume = emac_resume,
 };
-- 
2.40.1


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

* [PATCH net-next 05/54] net: ethernet: altera: Convert to platform remove callback returning void
  2023-09-18 20:41 [PATCH net-next 00/54] net: ethernet: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (3 preceding siblings ...)
  2023-09-18 20:41 ` [PATCH net-next 04/54] net: ethernet: allwinner: " Uwe Kleine-König
@ 2023-09-18 20:41 ` Uwe Kleine-König
  2023-09-18 20:41 ` [PATCH net-next 06/54] net: ethernet: amd: " Uwe Kleine-König
                   ` (49 subsequent siblings)
  54 siblings, 0 replies; 70+ messages in thread
From: Uwe Kleine-König @ 2023-09-18 20:41 UTC (permalink / raw)
  To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: Joyce Ooi, netdev, kernel

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.
To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new() which already returns void. Eventually after all drivers
are converted, .remove_new() is renamed to .remove().

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/net/ethernet/altera/altera_tse_main.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/altera/altera_tse_main.c b/drivers/net/ethernet/altera/altera_tse_main.c
index 2e15800e5310..1b1799985d1d 100644
--- a/drivers/net/ethernet/altera/altera_tse_main.c
+++ b/drivers/net/ethernet/altera/altera_tse_main.c
@@ -1464,7 +1464,7 @@ static int altera_tse_probe(struct platform_device *pdev)
 
 /* Remove Altera TSE MAC device
  */
-static int altera_tse_remove(struct platform_device *pdev)
+static void altera_tse_remove(struct platform_device *pdev)
 {
 	struct net_device *ndev = platform_get_drvdata(pdev);
 	struct altera_tse_private *priv = netdev_priv(ndev);
@@ -1476,8 +1476,6 @@ static int altera_tse_remove(struct platform_device *pdev)
 	lynx_pcs_destroy(priv->pcs);
 
 	free_netdev(ndev);
-
-	return 0;
 }
 
 static const struct altera_dmaops altera_dtype_sgdma = {
@@ -1528,7 +1526,7 @@ MODULE_DEVICE_TABLE(of, altera_tse_ids);
 
 static struct platform_driver altera_tse_driver = {
 	.probe		= altera_tse_probe,
-	.remove		= altera_tse_remove,
+	.remove_new	= altera_tse_remove,
 	.suspend	= NULL,
 	.resume		= NULL,
 	.driver		= {
-- 
2.40.1


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

* [PATCH net-next 06/54] net: ethernet: amd: Convert to platform remove callback returning void
  2023-09-18 20:41 [PATCH net-next 00/54] net: ethernet: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (4 preceding siblings ...)
  2023-09-18 20:41 ` [PATCH net-next 05/54] net: ethernet: altera: " Uwe Kleine-König
@ 2023-09-18 20:41 ` Uwe Kleine-König
  2023-09-18 20:41 ` [PATCH net-next 07/54] net: ethernet: apm: " Uwe Kleine-König
                   ` (48 subsequent siblings)
  54 siblings, 0 replies; 70+ messages in thread
From: Uwe Kleine-König @ 2023-09-18 20:41 UTC (permalink / raw)
  To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: Shyam Sundar S K, Bhupesh Sharma, Alex Elder, Wei Fang,
	Rob Herring, netdev, kernel

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.
To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new() which already returns void. Eventually after all drivers
are converted, .remove_new() is renamed to .remove().

Trivially convert these drivers from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/net/ethernet/amd/au1000_eth.c         | 6 ++----
 drivers/net/ethernet/amd/sunlance.c           | 6 ++----
 drivers/net/ethernet/amd/xgbe/xgbe-platform.c | 6 ++----
 3 files changed, 6 insertions(+), 12 deletions(-)

diff --git a/drivers/net/ethernet/amd/au1000_eth.c b/drivers/net/ethernet/amd/au1000_eth.c
index c5cec4e79489..85c978149bf6 100644
--- a/drivers/net/ethernet/amd/au1000_eth.c
+++ b/drivers/net/ethernet/amd/au1000_eth.c
@@ -1323,7 +1323,7 @@ static int au1000_probe(struct platform_device *pdev)
 	return err;
 }
 
-static int au1000_remove(struct platform_device *pdev)
+static void au1000_remove(struct platform_device *pdev)
 {
 	struct net_device *dev = platform_get_drvdata(pdev);
 	struct au1000_private *aup = netdev_priv(dev);
@@ -1359,13 +1359,11 @@ static int au1000_remove(struct platform_device *pdev)
 	release_mem_region(macen->start, resource_size(macen));
 
 	free_netdev(dev);
-
-	return 0;
 }
 
 static struct platform_driver au1000_eth_driver = {
 	.probe  = au1000_probe,
-	.remove = au1000_remove,
+	.remove_new = au1000_remove,
 	.driver = {
 		.name   = "au1000-eth",
 	},
diff --git a/drivers/net/ethernet/amd/sunlance.c b/drivers/net/ethernet/amd/sunlance.c
index 33bb539ad70a..c78706d21a6a 100644
--- a/drivers/net/ethernet/amd/sunlance.c
+++ b/drivers/net/ethernet/amd/sunlance.c
@@ -1487,7 +1487,7 @@ static int sunlance_sbus_probe(struct platform_device *op)
 	return err;
 }
 
-static int sunlance_sbus_remove(struct platform_device *op)
+static void sunlance_sbus_remove(struct platform_device *op)
 {
 	struct lance_private *lp = platform_get_drvdata(op);
 	struct net_device *net_dev = lp->dev;
@@ -1497,8 +1497,6 @@ static int sunlance_sbus_remove(struct platform_device *op)
 	lance_free_hwresources(lp);
 
 	free_netdev(net_dev);
-
-	return 0;
 }
 
 static const struct of_device_id sunlance_sbus_match[] = {
@@ -1516,7 +1514,7 @@ static struct platform_driver sunlance_sbus_driver = {
 		.of_match_table = sunlance_sbus_match,
 	},
 	.probe		= sunlance_sbus_probe,
-	.remove		= sunlance_sbus_remove,
+	.remove_new	= sunlance_sbus_remove,
 };
 
 module_platform_driver(sunlance_sbus_driver);
diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-platform.c b/drivers/net/ethernet/amd/xgbe/xgbe-platform.c
index 4d790a89fe77..91842a5e161b 100644
--- a/drivers/net/ethernet/amd/xgbe/xgbe-platform.c
+++ b/drivers/net/ethernet/amd/xgbe/xgbe-platform.c
@@ -512,7 +512,7 @@ static int xgbe_platform_probe(struct platform_device *pdev)
 	return ret;
 }
 
-static int xgbe_platform_remove(struct platform_device *pdev)
+static void xgbe_platform_remove(struct platform_device *pdev)
 {
 	struct xgbe_prv_data *pdata = platform_get_drvdata(pdev);
 
@@ -521,8 +521,6 @@ static int xgbe_platform_remove(struct platform_device *pdev)
 	platform_device_put(pdata->phy_platdev);
 
 	xgbe_free_pdata(pdata);
-
-	return 0;
 }
 
 #ifdef CONFIG_PM_SLEEP
@@ -615,7 +613,7 @@ static struct platform_driver xgbe_driver = {
 		.pm = &xgbe_platform_pm_ops,
 	},
 	.probe = xgbe_platform_probe,
-	.remove = xgbe_platform_remove,
+	.remove_new = xgbe_platform_remove,
 };
 
 int xgbe_platform_init(void)
-- 
2.40.1


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

* [PATCH net-next 07/54] net: ethernet: apm: Convert to platform remove callback returning void
  2023-09-18 20:41 [PATCH net-next 00/54] net: ethernet: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (5 preceding siblings ...)
  2023-09-18 20:41 ` [PATCH net-next 06/54] net: ethernet: amd: " Uwe Kleine-König
@ 2023-09-18 20:41 ` Uwe Kleine-König
  2023-09-18 20:41 ` [PATCH net-next 08/54] net: ethernet: apple: " Uwe Kleine-König
                   ` (47 subsequent siblings)
  54 siblings, 0 replies; 70+ messages in thread
From: Uwe Kleine-König @ 2023-09-18 20:41 UTC (permalink / raw)
  To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: Iyappan Subramanian, Keyur Chudgar, Quan Nguyen, netdev, kernel

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.
To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new() which already returns void. Eventually after all drivers
are converted, .remove_new() is renamed to .remove().

Trivially convert these driver from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/net/ethernet/apm/xgene-v2/main.c         | 6 ++----
 drivers/net/ethernet/apm/xgene/xgene_enet_main.c | 6 ++----
 2 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/drivers/net/ethernet/apm/xgene-v2/main.c b/drivers/net/ethernet/apm/xgene-v2/main.c
index 379d19d18dbe..9e90c2381491 100644
--- a/drivers/net/ethernet/apm/xgene-v2/main.c
+++ b/drivers/net/ethernet/apm/xgene-v2/main.c
@@ -690,7 +690,7 @@ static int xge_probe(struct platform_device *pdev)
 	return ret;
 }
 
-static int xge_remove(struct platform_device *pdev)
+static void xge_remove(struct platform_device *pdev)
 {
 	struct xge_pdata *pdata;
 	struct net_device *ndev;
@@ -706,8 +706,6 @@ static int xge_remove(struct platform_device *pdev)
 	xge_mdio_remove(ndev);
 	unregister_netdev(ndev);
 	free_netdev(ndev);
-
-	return 0;
 }
 
 static void xge_shutdown(struct platform_device *pdev)
@@ -736,7 +734,7 @@ static struct platform_driver xge_driver = {
 		   .acpi_match_table = ACPI_PTR(xge_acpi_match),
 	},
 	.probe = xge_probe,
-	.remove = xge_remove,
+	.remove_new = xge_remove,
 	.shutdown = xge_shutdown,
 };
 module_platform_driver(xge_driver);
diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
index 4d4140b7c450..b5d9f9a55b7f 100644
--- a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
+++ b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
@@ -2127,7 +2127,7 @@ static int xgene_enet_probe(struct platform_device *pdev)
 	return ret;
 }
 
-static int xgene_enet_remove(struct platform_device *pdev)
+static void xgene_enet_remove(struct platform_device *pdev)
 {
 	struct xgene_enet_pdata *pdata;
 	struct net_device *ndev;
@@ -2149,8 +2149,6 @@ static int xgene_enet_remove(struct platform_device *pdev)
 	xgene_enet_delete_desc_rings(pdata);
 	pdata->port_ops->shutdown(pdata);
 	free_netdev(ndev);
-
-	return 0;
 }
 
 static void xgene_enet_shutdown(struct platform_device *pdev)
@@ -2174,7 +2172,7 @@ static struct platform_driver xgene_enet_driver = {
 		   .acpi_match_table = ACPI_PTR(xgene_enet_acpi_match),
 	},
 	.probe = xgene_enet_probe,
-	.remove = xgene_enet_remove,
+	.remove_new = xgene_enet_remove,
 	.shutdown = xgene_enet_shutdown,
 };
 
-- 
2.40.1


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

* [PATCH net-next 08/54] net: ethernet: apple: Convert to platform remove callback returning void
  2023-09-18 20:41 [PATCH net-next 00/54] net: ethernet: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (6 preceding siblings ...)
  2023-09-18 20:41 ` [PATCH net-next 07/54] net: ethernet: apm: " Uwe Kleine-König
@ 2023-09-18 20:41 ` Uwe Kleine-König
  2023-09-18 20:41 ` [PATCH net-next 09/54] net: ethernet: arc: " Uwe Kleine-König
                   ` (46 subsequent siblings)
  54 siblings, 0 replies; 70+ messages in thread
From: Uwe Kleine-König @ 2023-09-18 20:41 UTC (permalink / raw)
  To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: Atul Raut, netdev, kernel

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.
To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new() which already returns void. Eventually after all drivers
are converted, .remove_new() is renamed to .remove().

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/net/ethernet/apple/macmace.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/apple/macmace.c b/drivers/net/ethernet/apple/macmace.c
index 8775c3234e91..766ab78256fe 100644
--- a/drivers/net/ethernet/apple/macmace.c
+++ b/drivers/net/ethernet/apple/macmace.c
@@ -739,7 +739,7 @@ MODULE_LICENSE("GPL");
 MODULE_DESCRIPTION("Macintosh MACE ethernet driver");
 MODULE_ALIAS("platform:macmace");
 
-static int mac_mace_device_remove(struct platform_device *pdev)
+static void mac_mace_device_remove(struct platform_device *pdev)
 {
 	struct net_device *dev = platform_get_drvdata(pdev);
 	struct mace_data *mp = netdev_priv(dev);
@@ -755,13 +755,11 @@ static int mac_mace_device_remove(struct platform_device *pdev)
 	                  mp->tx_ring, mp->tx_ring_phys);
 
 	free_netdev(dev);
-
-	return 0;
 }
 
 static struct platform_driver mac_mace_driver = {
 	.probe  = mace_probe,
-	.remove = mac_mace_device_remove,
+	.remove_new = mac_mace_device_remove,
 	.driver	= {
 		.name	= mac_mace_string,
 	},
-- 
2.40.1


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

* [PATCH net-next 09/54] net: ethernet: arc: Convert to platform remove callback returning void
  2023-09-18 20:41 [PATCH net-next 00/54] net: ethernet: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (7 preceding siblings ...)
  2023-09-18 20:41 ` [PATCH net-next 08/54] net: ethernet: apple: " Uwe Kleine-König
@ 2023-09-18 20:41 ` Uwe Kleine-König
  2023-09-18 20:41 ` [PATCH net-next 10/54] net: ethernet: atheros: " Uwe Kleine-König
                   ` (45 subsequent siblings)
  54 siblings, 0 replies; 70+ messages in thread
From: Uwe Kleine-König @ 2023-09-18 20:41 UTC (permalink / raw)
  To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: Heiko Stuebner, Simon Horman, netdev, kernel, linux-arm-kernel,
	linux-rockchip

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.
To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new() which already returns void. Eventually after all drivers
are converted, .remove_new() is renamed to .remove().

Trivially convert these drivers from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/net/ethernet/arc/emac_arc.c      | 6 ++----
 drivers/net/ethernet/arc/emac_rockchip.c | 5 ++---
 2 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/net/ethernet/arc/emac_arc.c b/drivers/net/ethernet/arc/emac_arc.c
index ce3147e886a1..a3afddb23ee8 100644
--- a/drivers/net/ethernet/arc/emac_arc.c
+++ b/drivers/net/ethernet/arc/emac_arc.c
@@ -58,14 +58,12 @@ static int emac_arc_probe(struct platform_device *pdev)
 	return err;
 }
 
-static int emac_arc_remove(struct platform_device *pdev)
+static void emac_arc_remove(struct platform_device *pdev)
 {
 	struct net_device *ndev = platform_get_drvdata(pdev);
 
 	arc_emac_remove(ndev);
 	free_netdev(ndev);
-
-	return 0;
 }
 
 static const struct of_device_id emac_arc_dt_ids[] = {
@@ -76,7 +74,7 @@ MODULE_DEVICE_TABLE(of, emac_arc_dt_ids);
 
 static struct platform_driver emac_arc_driver = {
 	.probe = emac_arc_probe,
-	.remove = emac_arc_remove,
+	.remove_new = emac_arc_remove,
 	.driver = {
 		.name = DRV_NAME,
 		.of_match_table  = emac_arc_dt_ids,
diff --git a/drivers/net/ethernet/arc/emac_rockchip.c b/drivers/net/ethernet/arc/emac_rockchip.c
index 509101112279..493d6356c8ca 100644
--- a/drivers/net/ethernet/arc/emac_rockchip.c
+++ b/drivers/net/ethernet/arc/emac_rockchip.c
@@ -244,7 +244,7 @@ static int emac_rockchip_probe(struct platform_device *pdev)
 	return err;
 }
 
-static int emac_rockchip_remove(struct platform_device *pdev)
+static void emac_rockchip_remove(struct platform_device *pdev)
 {
 	struct net_device *ndev = platform_get_drvdata(pdev);
 	struct rockchip_priv_data *priv = netdev_priv(ndev);
@@ -260,12 +260,11 @@ static int emac_rockchip_remove(struct platform_device *pdev)
 		clk_disable_unprepare(priv->macclk);
 
 	free_netdev(ndev);
-	return 0;
 }
 
 static struct platform_driver emac_rockchip_driver = {
 	.probe = emac_rockchip_probe,
-	.remove = emac_rockchip_remove,
+	.remove_new = emac_rockchip_remove,
 	.driver = {
 		.name = DRV_NAME,
 		.of_match_table  = emac_rockchip_dt_ids,
-- 
2.40.1


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

* [PATCH net-next 10/54] net: ethernet: atheros: Convert to platform remove callback returning void
  2023-09-18 20:41 [PATCH net-next 00/54] net: ethernet: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (8 preceding siblings ...)
  2023-09-18 20:41 ` [PATCH net-next 09/54] net: ethernet: arc: " Uwe Kleine-König
@ 2023-09-18 20:41 ` Uwe Kleine-König
  2023-09-18 20:41 ` [PATCH net-next 11/54] net: ethernet: broadcom: " Uwe Kleine-König
                   ` (44 subsequent siblings)
  54 siblings, 0 replies; 70+ messages in thread
From: Uwe Kleine-König @ 2023-09-18 20:41 UTC (permalink / raw)
  To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: Chris Snook, netdev, kernel

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.
To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new() which already returns void. Eventually after all drivers
are converted, .remove_new() is renamed to .remove().

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/net/ethernet/atheros/ag71xx.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/atheros/ag71xx.c b/drivers/net/ethernet/atheros/ag71xx.c
index 009e0b3066fa..0f2f400b5bc4 100644
--- a/drivers/net/ethernet/atheros/ag71xx.c
+++ b/drivers/net/ethernet/atheros/ag71xx.c
@@ -1968,21 +1968,19 @@ static int ag71xx_probe(struct platform_device *pdev)
 	return err;
 }
 
-static int ag71xx_remove(struct platform_device *pdev)
+static void ag71xx_remove(struct platform_device *pdev)
 {
 	struct net_device *ndev = platform_get_drvdata(pdev);
 	struct ag71xx *ag;
 
 	if (!ndev)
-		return 0;
+		return;
 
 	ag = netdev_priv(ndev);
 	unregister_netdev(ndev);
 	ag71xx_mdio_remove(ag);
 	clk_disable_unprepare(ag->clk_eth);
 	platform_set_drvdata(pdev, NULL);
-
-	return 0;
 }
 
 static const u32 ar71xx_fifo_ar7100[] = {
@@ -2069,7 +2067,7 @@ static const struct of_device_id ag71xx_match[] = {
 
 static struct platform_driver ag71xx_driver = {
 	.probe		= ag71xx_probe,
-	.remove		= ag71xx_remove,
+	.remove_new	= ag71xx_remove,
 	.driver = {
 		.name	= "ag71xx",
 		.of_match_table = ag71xx_match,
-- 
2.40.1


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

* [PATCH net-next 11/54] net: ethernet: broadcom: Convert to platform remove callback returning void
  2023-09-18 20:41 [PATCH net-next 00/54] net: ethernet: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (9 preceding siblings ...)
  2023-09-18 20:41 ` [PATCH net-next 10/54] net: ethernet: atheros: " Uwe Kleine-König
@ 2023-09-18 20:41 ` Uwe Kleine-König
  2023-09-18 20:55   ` Florian Fainelli
  2023-09-18 20:41 ` [PATCH net-next 12/54] net: ethernet: cadence: " Uwe Kleine-König
                   ` (43 subsequent siblings)
  54 siblings, 1 reply; 70+ messages in thread
From: Uwe Kleine-König @ 2023-09-18 20:41 UTC (permalink / raw)
  To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: Justin Chen, Florian Fainelli, Rafał Miłecki,
	Broadcom internal kernel review list, Doug Berger, Li Zetao,
	Steen Hegelund, Lukas Bulwahn, netdev, kernel

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.
To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new() which already returns void. Eventually after all drivers
are converted, .remove_new() is renamed to .remove().

Trivially convert these drivers from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/net/ethernet/broadcom/asp2/bcmasp.c    |  8 +++-----
 drivers/net/ethernet/broadcom/bcm4908_enet.c   |  6 ++----
 drivers/net/ethernet/broadcom/bcm63xx_enet.c   | 10 ++++------
 drivers/net/ethernet/broadcom/bcmsysport.c     |  6 ++----
 drivers/net/ethernet/broadcom/bgmac-platform.c |  6 ++----
 drivers/net/ethernet/broadcom/genet/bcmgenet.c |  6 ++----
 drivers/net/ethernet/broadcom/sb1250-mac.c     |  6 ++----
 7 files changed, 17 insertions(+), 31 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/asp2/bcmasp.c b/drivers/net/ethernet/broadcom/asp2/bcmasp.c
index 41a6098eb0c2..29b04a274d07 100644
--- a/drivers/net/ethernet/broadcom/asp2/bcmasp.c
+++ b/drivers/net/ethernet/broadcom/asp2/bcmasp.c
@@ -1344,17 +1344,15 @@ static int bcmasp_probe(struct platform_device *pdev)
 	return ret;
 }
 
-static int bcmasp_remove(struct platform_device *pdev)
+static void bcmasp_remove(struct platform_device *pdev)
 {
 	struct bcmasp_priv *priv = dev_get_drvdata(&pdev->dev);
 
 	if (!priv)
-		return 0;
+		return;
 
 	priv->destroy_wol(priv);
 	bcmasp_remove_intfs(priv);
-
-	return 0;
 }
 
 static void bcmasp_shutdown(struct platform_device *pdev)
@@ -1428,7 +1426,7 @@ static SIMPLE_DEV_PM_OPS(bcmasp_pm_ops,
 
 static struct platform_driver bcmasp_driver = {
 	.probe = bcmasp_probe,
-	.remove = bcmasp_remove,
+	.remove_new = bcmasp_remove,
 	.shutdown = bcmasp_shutdown,
 	.driver = {
 		.name = "brcm,asp-v2",
diff --git a/drivers/net/ethernet/broadcom/bcm4908_enet.c b/drivers/net/ethernet/broadcom/bcm4908_enet.c
index 33d86683af50..3e7c8671cd11 100644
--- a/drivers/net/ethernet/broadcom/bcm4908_enet.c
+++ b/drivers/net/ethernet/broadcom/bcm4908_enet.c
@@ -768,7 +768,7 @@ static int bcm4908_enet_probe(struct platform_device *pdev)
 	return err;
 }
 
-static int bcm4908_enet_remove(struct platform_device *pdev)
+static void bcm4908_enet_remove(struct platform_device *pdev)
 {
 	struct bcm4908_enet *enet = platform_get_drvdata(pdev);
 
@@ -776,8 +776,6 @@ static int bcm4908_enet_remove(struct platform_device *pdev)
 	netif_napi_del(&enet->rx_ring.napi);
 	netif_napi_del(&enet->tx_ring.napi);
 	bcm4908_enet_dma_free(enet);
-
-	return 0;
 }
 
 static const struct of_device_id bcm4908_enet_of_match[] = {
@@ -791,7 +789,7 @@ static struct platform_driver bcm4908_enet_driver = {
 		.of_match_table = bcm4908_enet_of_match,
 	},
 	.probe	= bcm4908_enet_probe,
-	.remove = bcm4908_enet_remove,
+	.remove_new = bcm4908_enet_remove,
 };
 module_platform_driver(bcm4908_enet_driver);
 
diff --git a/drivers/net/ethernet/broadcom/bcm63xx_enet.c b/drivers/net/ethernet/broadcom/bcm63xx_enet.c
index a741070f1f9a..105afde5dbe1 100644
--- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c
+++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c
@@ -1902,7 +1902,7 @@ static int bcm_enet_probe(struct platform_device *pdev)
 /*
  * exit func, stops hardware and unregisters netdevice
  */
-static int bcm_enet_remove(struct platform_device *pdev)
+static void bcm_enet_remove(struct platform_device *pdev)
 {
 	struct bcm_enet_priv *priv;
 	struct net_device *dev;
@@ -1932,12 +1932,11 @@ static int bcm_enet_remove(struct platform_device *pdev)
 	clk_disable_unprepare(priv->mac_clk);
 
 	free_netdev(dev);
-	return 0;
 }
 
 static struct platform_driver bcm63xx_enet_driver = {
 	.probe	= bcm_enet_probe,
-	.remove	= bcm_enet_remove,
+	.remove_new = bcm_enet_remove,
 	.driver	= {
 		.name	= "bcm63xx_enet",
 	},
@@ -2739,7 +2738,7 @@ static int bcm_enetsw_probe(struct platform_device *pdev)
 
 
 /* exit func, stops hardware and unregisters netdevice */
-static int bcm_enetsw_remove(struct platform_device *pdev)
+static void bcm_enetsw_remove(struct platform_device *pdev)
 {
 	struct bcm_enet_priv *priv;
 	struct net_device *dev;
@@ -2752,12 +2751,11 @@ static int bcm_enetsw_remove(struct platform_device *pdev)
 	clk_disable_unprepare(priv->mac_clk);
 
 	free_netdev(dev);
-	return 0;
 }
 
 static struct platform_driver bcm63xx_enetsw_driver = {
 	.probe	= bcm_enetsw_probe,
-	.remove	= bcm_enetsw_remove,
+	.remove_new = bcm_enetsw_remove,
 	.driver	= {
 		.name	= "bcm63xx_enetsw",
 	},
diff --git a/drivers/net/ethernet/broadcom/bcmsysport.c b/drivers/net/ethernet/broadcom/bcmsysport.c
index bf1611cce974..ab096795e805 100644
--- a/drivers/net/ethernet/broadcom/bcmsysport.c
+++ b/drivers/net/ethernet/broadcom/bcmsysport.c
@@ -2648,7 +2648,7 @@ static int bcm_sysport_probe(struct platform_device *pdev)
 	return ret;
 }
 
-static int bcm_sysport_remove(struct platform_device *pdev)
+static void bcm_sysport_remove(struct platform_device *pdev)
 {
 	struct net_device *dev = dev_get_drvdata(&pdev->dev);
 	struct bcm_sysport_priv *priv = netdev_priv(dev);
@@ -2663,8 +2663,6 @@ static int bcm_sysport_remove(struct platform_device *pdev)
 		of_phy_deregister_fixed_link(dn);
 	free_netdev(dev);
 	dev_set_drvdata(&pdev->dev, NULL);
-
-	return 0;
 }
 
 static int bcm_sysport_suspend_to_wol(struct bcm_sysport_priv *priv)
@@ -2901,7 +2899,7 @@ static SIMPLE_DEV_PM_OPS(bcm_sysport_pm_ops,
 
 static struct platform_driver bcm_sysport_driver = {
 	.probe	= bcm_sysport_probe,
-	.remove	= bcm_sysport_remove,
+	.remove_new = bcm_sysport_remove,
 	.driver =  {
 		.name = "brcm-systemport",
 		.of_match_table = bcm_sysport_of_match,
diff --git a/drivers/net/ethernet/broadcom/bgmac-platform.c b/drivers/net/ethernet/broadcom/bgmac-platform.c
index b4381cd41979..0b21fd5bd457 100644
--- a/drivers/net/ethernet/broadcom/bgmac-platform.c
+++ b/drivers/net/ethernet/broadcom/bgmac-platform.c
@@ -246,13 +246,11 @@ static int bgmac_probe(struct platform_device *pdev)
 	return bgmac_enet_probe(bgmac);
 }
 
-static int bgmac_remove(struct platform_device *pdev)
+static void bgmac_remove(struct platform_device *pdev)
 {
 	struct bgmac *bgmac = platform_get_drvdata(pdev);
 
 	bgmac_enet_remove(bgmac);
-
-	return 0;
 }
 
 #ifdef CONFIG_PM
@@ -296,7 +294,7 @@ static struct platform_driver bgmac_enet_driver = {
 		.pm = BGMAC_PM_OPS
 	},
 	.probe = bgmac_probe,
-	.remove = bgmac_remove,
+	.remove_new = bgmac_remove,
 };
 
 module_platform_driver(bgmac_enet_driver);
diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
index 24bade875ca6..91f3a7e78d65 100644
--- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c
+++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
@@ -4164,7 +4164,7 @@ static int bcmgenet_probe(struct platform_device *pdev)
 	return err;
 }
 
-static int bcmgenet_remove(struct platform_device *pdev)
+static void bcmgenet_remove(struct platform_device *pdev)
 {
 	struct bcmgenet_priv *priv = dev_to_priv(&pdev->dev);
 
@@ -4172,8 +4172,6 @@ static int bcmgenet_remove(struct platform_device *pdev)
 	unregister_netdev(priv->dev);
 	bcmgenet_mii_exit(priv->dev);
 	free_netdev(priv->dev);
-
-	return 0;
 }
 
 static void bcmgenet_shutdown(struct platform_device *pdev)
@@ -4352,7 +4350,7 @@ MODULE_DEVICE_TABLE(acpi, genet_acpi_match);
 
 static struct platform_driver bcmgenet_driver = {
 	.probe	= bcmgenet_probe,
-	.remove	= bcmgenet_remove,
+	.remove_new = bcmgenet_remove,
 	.shutdown = bcmgenet_shutdown,
 	.driver	= {
 		.name	= "bcmgenet",
diff --git a/drivers/net/ethernet/broadcom/sb1250-mac.c b/drivers/net/ethernet/broadcom/sb1250-mac.c
index 3a6763c5e8b3..fcf8485f3446 100644
--- a/drivers/net/ethernet/broadcom/sb1250-mac.c
+++ b/drivers/net/ethernet/broadcom/sb1250-mac.c
@@ -2593,7 +2593,7 @@ static int sbmac_probe(struct platform_device *pldev)
 	return err;
 }
 
-static int sbmac_remove(struct platform_device *pldev)
+static void sbmac_remove(struct platform_device *pldev)
 {
 	struct net_device *dev = platform_get_drvdata(pldev);
 	struct sbmac_softc *sc = netdev_priv(dev);
@@ -2604,13 +2604,11 @@ static int sbmac_remove(struct platform_device *pldev)
 	mdiobus_free(sc->mii_bus);
 	iounmap(sc->sbm_base);
 	free_netdev(dev);
-
-	return 0;
 }
 
 static struct platform_driver sbmac_driver = {
 	.probe = sbmac_probe,
-	.remove = sbmac_remove,
+	.remove_new = sbmac_remove,
 	.driver = {
 		.name = sbmac_string,
 	},
-- 
2.40.1


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

* [PATCH net-next 12/54] net: ethernet: cadence: Convert to platform remove callback returning void
  2023-09-18 20:41 [PATCH net-next 00/54] net: ethernet: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (10 preceding siblings ...)
  2023-09-18 20:41 ` [PATCH net-next 11/54] net: ethernet: broadcom: " Uwe Kleine-König
@ 2023-09-18 20:41 ` Uwe Kleine-König
  2023-09-19  6:00   ` claudiu beznea
  2023-09-18 20:41 ` [PATCH net-next 13/54] net: ethernet: calxeda: " Uwe Kleine-König
                   ` (42 subsequent siblings)
  54 siblings, 1 reply; 70+ messages in thread
From: Uwe Kleine-König @ 2023-09-18 20:41 UTC (permalink / raw)
  To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: Nicolas Ferre, Claudiu Beznea, Russell King, netdev, kernel

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.
To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new() which already returns void. Eventually after all drivers
are converted, .remove_new() is renamed to .remove().

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/net/ethernet/cadence/macb_main.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c
index b940dcd3ace6..cebae0f418f2 100644
--- a/drivers/net/ethernet/cadence/macb_main.c
+++ b/drivers/net/ethernet/cadence/macb_main.c
@@ -5156,7 +5156,7 @@ static int macb_probe(struct platform_device *pdev)
 	return err;
 }
 
-static int macb_remove(struct platform_device *pdev)
+static void macb_remove(struct platform_device *pdev)
 {
 	struct net_device *dev;
 	struct macb *bp;
@@ -5181,8 +5181,6 @@ static int macb_remove(struct platform_device *pdev)
 		phylink_destroy(bp->phylink);
 		free_netdev(dev);
 	}
-
-	return 0;
 }
 
 static int __maybe_unused macb_suspend(struct device *dev)
@@ -5398,7 +5396,7 @@ static const struct dev_pm_ops macb_pm_ops = {
 
 static struct platform_driver macb_driver = {
 	.probe		= macb_probe,
-	.remove		= macb_remove,
+	.remove_new	= macb_remove,
 	.driver		= {
 		.name		= "macb",
 		.of_match_table	= of_match_ptr(macb_dt_ids),
-- 
2.40.1


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

* [PATCH net-next 13/54] net: ethernet: calxeda: Convert to platform remove callback returning void
  2023-09-18 20:41 [PATCH net-next 00/54] net: ethernet: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (11 preceding siblings ...)
  2023-09-18 20:41 ` [PATCH net-next 12/54] net: ethernet: cadence: " Uwe Kleine-König
@ 2023-09-18 20:41 ` Uwe Kleine-König
  2023-09-18 20:41 ` [PATCH net-next 14/54] net: ethernet: cavium: " Uwe Kleine-König
                   ` (41 subsequent siblings)
  54 siblings, 0 replies; 70+ messages in thread
From: Uwe Kleine-König @ 2023-09-18 20:41 UTC (permalink / raw)
  To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: Marc Kleine-Budde, netdev, kernel

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.
To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new() which already returns void. Eventually after all drivers
are converted, .remove_new() is renamed to .remove().

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/net/ethernet/calxeda/xgmac.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/calxeda/xgmac.c b/drivers/net/ethernet/calxeda/xgmac.c
index f4f87dfa9687..5e97f1e4e38e 100644
--- a/drivers/net/ethernet/calxeda/xgmac.c
+++ b/drivers/net/ethernet/calxeda/xgmac.c
@@ -1820,7 +1820,7 @@ static int xgmac_probe(struct platform_device *pdev)
  * changes the link status, releases the DMA descriptor rings,
  * unregisters the MDIO bus and unmaps the allocated memory.
  */
-static int xgmac_remove(struct platform_device *pdev)
+static void xgmac_remove(struct platform_device *pdev)
 {
 	struct net_device *ndev = platform_get_drvdata(pdev);
 	struct xgmac_priv *priv = netdev_priv(ndev);
@@ -1840,8 +1840,6 @@ static int xgmac_remove(struct platform_device *pdev)
 	release_mem_region(res->start, resource_size(res));
 
 	free_netdev(ndev);
-
-	return 0;
 }
 
 #ifdef CONFIG_PM_SLEEP
@@ -1921,7 +1919,7 @@ static struct platform_driver xgmac_driver = {
 		.pm = &xgmac_pm_ops,
 	},
 	.probe = xgmac_probe,
-	.remove = xgmac_remove,
+	.remove_new = xgmac_remove,
 };
 
 module_platform_driver(xgmac_driver);
-- 
2.40.1


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

* [PATCH net-next 14/54] net: ethernet: cavium: Convert to platform remove callback returning void
  2023-09-18 20:41 [PATCH net-next 00/54] net: ethernet: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (12 preceding siblings ...)
  2023-09-18 20:41 ` [PATCH net-next 13/54] net: ethernet: calxeda: " Uwe Kleine-König
@ 2023-09-18 20:41 ` Uwe Kleine-König
  2023-09-18 20:41 ` [PATCH net-next 15/54] net: ethernet: cirrus: " Uwe Kleine-König
                   ` (40 subsequent siblings)
  54 siblings, 0 replies; 70+ messages in thread
From: Uwe Kleine-König @ 2023-09-18 20:41 UTC (permalink / raw)
  To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni; +Cc: netdev, kernel

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.
To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new() which already returns void. Eventually after all drivers
are converted, .remove_new() is renamed to .remove().

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/net/ethernet/cavium/octeon/octeon_mgmt.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/cavium/octeon/octeon_mgmt.c b/drivers/net/ethernet/cavium/octeon/octeon_mgmt.c
index edde0b8fa49c..007d4b06819e 100644
--- a/drivers/net/ethernet/cavium/octeon/octeon_mgmt.c
+++ b/drivers/net/ethernet/cavium/octeon/octeon_mgmt.c
@@ -1521,7 +1521,7 @@ static int octeon_mgmt_probe(struct platform_device *pdev)
 	return result;
 }
 
-static int octeon_mgmt_remove(struct platform_device *pdev)
+static void octeon_mgmt_remove(struct platform_device *pdev)
 {
 	struct net_device *netdev = platform_get_drvdata(pdev);
 	struct octeon_mgmt *p = netdev_priv(netdev);
@@ -1529,7 +1529,6 @@ static int octeon_mgmt_remove(struct platform_device *pdev)
 	unregister_netdev(netdev);
 	of_node_put(p->phy_np);
 	free_netdev(netdev);
-	return 0;
 }
 
 static const struct of_device_id octeon_mgmt_match[] = {
@@ -1546,7 +1545,7 @@ static struct platform_driver octeon_mgmt_driver = {
 		.of_match_table = octeon_mgmt_match,
 	},
 	.probe		= octeon_mgmt_probe,
-	.remove		= octeon_mgmt_remove,
+	.remove_new	= octeon_mgmt_remove,
 };
 
 module_platform_driver(octeon_mgmt_driver);
-- 
2.40.1


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

* [PATCH net-next 15/54] net: ethernet: cirrus: Convert to platform remove callback returning void
  2023-09-18 20:41 [PATCH net-next 00/54] net: ethernet: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (13 preceding siblings ...)
  2023-09-18 20:41 ` [PATCH net-next 14/54] net: ethernet: cavium: " Uwe Kleine-König
@ 2023-09-18 20:41 ` Uwe Kleine-König
  2023-09-18 20:41 ` [PATCH net-next 16/54] net: ethernet: cortina: " Uwe Kleine-König
                   ` (39 subsequent siblings)
  54 siblings, 0 replies; 70+ messages in thread
From: Uwe Kleine-König @ 2023-09-18 20:41 UTC (permalink / raw)
  To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: Hartley Sweeten, Simon Horman, Alex Elder, Arnd Bergmann,
	Rob Herring, Ruan Jinjie, netdev, kernel

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.
To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new() which already returns void. Eventually after all drivers
are converted, .remove_new() is renamed to .remove().

Trivially convert these drivers from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/net/ethernet/cirrus/cs89x0.c     | 5 ++---
 drivers/net/ethernet/cirrus/ep93xx_eth.c | 8 +++-----
 drivers/net/ethernet/cirrus/mac89x0.c    | 5 ++---
 3 files changed, 7 insertions(+), 11 deletions(-)

diff --git a/drivers/net/ethernet/cirrus/cs89x0.c b/drivers/net/ethernet/cirrus/cs89x0.c
index d323c5c23521..0a21a10a791c 100644
--- a/drivers/net/ethernet/cirrus/cs89x0.c
+++ b/drivers/net/ethernet/cirrus/cs89x0.c
@@ -1879,7 +1879,7 @@ static int __init cs89x0_platform_probe(struct platform_device *pdev)
 	return err;
 }
 
-static int cs89x0_platform_remove(struct platform_device *pdev)
+static void cs89x0_platform_remove(struct platform_device *pdev)
 {
 	struct net_device *dev = platform_get_drvdata(pdev);
 
@@ -1889,7 +1889,6 @@ static int cs89x0_platform_remove(struct platform_device *pdev)
 	 */
 	unregister_netdev(dev);
 	free_netdev(dev);
-	return 0;
 }
 
 static const struct of_device_id __maybe_unused cs89x0_match[] = {
@@ -1904,7 +1903,7 @@ static struct platform_driver cs89x0_driver = {
 		.name		= DRV_NAME,
 		.of_match_table	= of_match_ptr(cs89x0_match),
 	},
-	.remove	= cs89x0_platform_remove,
+	.remove_new = cs89x0_platform_remove,
 };
 
 module_platform_driver_probe(cs89x0_driver, cs89x0_platform_probe);
diff --git a/drivers/net/ethernet/cirrus/ep93xx_eth.c b/drivers/net/ethernet/cirrus/ep93xx_eth.c
index 8627ab19d470..1c2a540db13d 100644
--- a/drivers/net/ethernet/cirrus/ep93xx_eth.c
+++ b/drivers/net/ethernet/cirrus/ep93xx_eth.c
@@ -757,7 +757,7 @@ static struct net_device *ep93xx_dev_alloc(struct ep93xx_eth_data *data)
 }
 
 
-static int ep93xx_eth_remove(struct platform_device *pdev)
+static void ep93xx_eth_remove(struct platform_device *pdev)
 {
 	struct net_device *dev;
 	struct ep93xx_priv *ep;
@@ -765,7 +765,7 @@ static int ep93xx_eth_remove(struct platform_device *pdev)
 
 	dev = platform_get_drvdata(pdev);
 	if (dev == NULL)
-		return 0;
+		return;
 
 	ep = netdev_priv(dev);
 
@@ -782,8 +782,6 @@ static int ep93xx_eth_remove(struct platform_device *pdev)
 	}
 
 	free_netdev(dev);
-
-	return 0;
 }
 
 static int ep93xx_eth_probe(struct platform_device *pdev)
@@ -862,7 +860,7 @@ static int ep93xx_eth_probe(struct platform_device *pdev)
 
 static struct platform_driver ep93xx_eth_driver = {
 	.probe		= ep93xx_eth_probe,
-	.remove		= ep93xx_eth_remove,
+	.remove_new	= ep93xx_eth_remove,
 	.driver		= {
 		.name	= "ep93xx-eth",
 	},
diff --git a/drivers/net/ethernet/cirrus/mac89x0.c b/drivers/net/ethernet/cirrus/mac89x0.c
index 21a70b1f0ac5..887876f35f10 100644
--- a/drivers/net/ethernet/cirrus/mac89x0.c
+++ b/drivers/net/ethernet/cirrus/mac89x0.c
@@ -556,19 +556,18 @@ static int set_mac_address(struct net_device *dev, void *addr)
 
 MODULE_LICENSE("GPL");
 
-static int mac89x0_device_remove(struct platform_device *pdev)
+static void mac89x0_device_remove(struct platform_device *pdev)
 {
 	struct net_device *dev = platform_get_drvdata(pdev);
 
 	unregister_netdev(dev);
 	nubus_writew(0, dev->base_addr + ADD_PORT);
 	free_netdev(dev);
-	return 0;
 }
 
 static struct platform_driver mac89x0_platform_driver = {
 	.probe = mac89x0_device_probe,
-	.remove = mac89x0_device_remove,
+	.remove_new = mac89x0_device_remove,
 	.driver = {
 		.name = "mac89x0",
 	},
-- 
2.40.1


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

* [PATCH net-next 16/54] net: ethernet: cortina: Convert to platform remove callback returning void
  2023-09-18 20:41 [PATCH net-next 00/54] net: ethernet: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (14 preceding siblings ...)
  2023-09-18 20:41 ` [PATCH net-next 15/54] net: ethernet: cirrus: " Uwe Kleine-König
@ 2023-09-18 20:41 ` Uwe Kleine-König
  2023-09-18 20:41 ` [PATCH net-next 17/54] net: ethernet: davicom: " Uwe Kleine-König
                   ` (38 subsequent siblings)
  54 siblings, 0 replies; 70+ messages in thread
From: Uwe Kleine-König @ 2023-09-18 20:41 UTC (permalink / raw)
  To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: Hans Ulli Kroll, Linus Walleij, linux-arm-kernel, netdev, kernel

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.
To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new() which already returns void. Eventually after all drivers
are converted, .remove_new() is renamed to .remove().

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/net/ethernet/cortina/gemini.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/drivers/net/ethernet/cortina/gemini.c b/drivers/net/ethernet/cortina/gemini.c
index a8b9d1a3e4d5..5423fe26b4ef 100644
--- a/drivers/net/ethernet/cortina/gemini.c
+++ b/drivers/net/ethernet/cortina/gemini.c
@@ -2518,13 +2518,11 @@ static int gemini_ethernet_port_probe(struct platform_device *pdev)
 	return ret;
 }
 
-static int gemini_ethernet_port_remove(struct platform_device *pdev)
+static void gemini_ethernet_port_remove(struct platform_device *pdev)
 {
 	struct gemini_ethernet_port *port = platform_get_drvdata(pdev);
 
 	gemini_port_remove(port);
-
-	return 0;
 }
 
 static const struct of_device_id gemini_ethernet_port_of_match[] = {
@@ -2541,7 +2539,7 @@ static struct platform_driver gemini_ethernet_port_driver = {
 		.of_match_table = gemini_ethernet_port_of_match,
 	},
 	.probe = gemini_ethernet_port_probe,
-	.remove = gemini_ethernet_port_remove,
+	.remove_new = gemini_ethernet_port_remove,
 };
 
 static int gemini_ethernet_probe(struct platform_device *pdev)
@@ -2583,14 +2581,12 @@ static int gemini_ethernet_probe(struct platform_device *pdev)
 	return devm_of_platform_populate(dev);
 }
 
-static int gemini_ethernet_remove(struct platform_device *pdev)
+static void gemini_ethernet_remove(struct platform_device *pdev)
 {
 	struct gemini_ethernet *geth = platform_get_drvdata(pdev);
 
 	geth_cleanup_freeq(geth);
 	geth->initialized = false;
-
-	return 0;
 }
 
 static const struct of_device_id gemini_ethernet_of_match[] = {
@@ -2607,7 +2603,7 @@ static struct platform_driver gemini_ethernet_driver = {
 		.of_match_table = gemini_ethernet_of_match,
 	},
 	.probe = gemini_ethernet_probe,
-	.remove = gemini_ethernet_remove,
+	.remove_new = gemini_ethernet_remove,
 };
 
 static int __init gemini_ethernet_module_init(void)
-- 
2.40.1


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

* [PATCH net-next 17/54] net: ethernet: davicom: Convert to platform remove callback returning void
  2023-09-18 20:41 [PATCH net-next 00/54] net: ethernet: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (15 preceding siblings ...)
  2023-09-18 20:41 ` [PATCH net-next 16/54] net: ethernet: cortina: " Uwe Kleine-König
@ 2023-09-18 20:41 ` Uwe Kleine-König
  2023-09-18 20:41 ` [PATCH net-next 18/54] net: ethernet: dnet: " Uwe Kleine-König
                   ` (37 subsequent siblings)
  54 siblings, 0 replies; 70+ messages in thread
From: Uwe Kleine-König @ 2023-09-18 20:41 UTC (permalink / raw)
  To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: Wei Fang, Simon Horman, Kalle Valo, Marc Kleine-Budde,
	Nathan Huckleberry, Rob Herring, netdev, kernel

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.
To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new() which already returns void. Eventually after all drivers
are converted, .remove_new() is renamed to .remove().

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/net/ethernet/davicom/dm9000.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/davicom/dm9000.c b/drivers/net/ethernet/davicom/dm9000.c
index 05a89ab6766c..150cc94ae9f8 100644
--- a/drivers/net/ethernet/davicom/dm9000.c
+++ b/drivers/net/ethernet/davicom/dm9000.c
@@ -1770,8 +1770,7 @@ static const struct dev_pm_ops dm9000_drv_pm_ops = {
 	.resume		= dm9000_drv_resume,
 };
 
-static int
-dm9000_drv_remove(struct platform_device *pdev)
+static void dm9000_drv_remove(struct platform_device *pdev)
 {
 	struct net_device *ndev = platform_get_drvdata(pdev);
 	struct board_info *dm = to_dm9000_board(ndev);
@@ -1783,7 +1782,6 @@ dm9000_drv_remove(struct platform_device *pdev)
 		regulator_disable(dm->power_supply);
 
 	dev_dbg(&pdev->dev, "released and freed device\n");
-	return 0;
 }
 
 #ifdef CONFIG_OF
@@ -1801,7 +1799,7 @@ static struct platform_driver dm9000_driver = {
 		.of_match_table = of_match_ptr(dm9000_of_matches),
 	},
 	.probe   = dm9000_probe,
-	.remove  = dm9000_drv_remove,
+	.remove_new = dm9000_drv_remove,
 };
 
 module_platform_driver(dm9000_driver);
-- 
2.40.1


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

* [PATCH net-next 18/54] net: ethernet: dnet: Convert to platform remove callback returning void
  2023-09-18 20:41 [PATCH net-next 00/54] net: ethernet: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (16 preceding siblings ...)
  2023-09-18 20:41 ` [PATCH net-next 17/54] net: ethernet: davicom: " Uwe Kleine-König
@ 2023-09-18 20:41 ` Uwe Kleine-König
  2023-09-18 20:41 ` [PATCH net-next 19/54] net: ethernet: engleder: " Uwe Kleine-König
                   ` (36 subsequent siblings)
  54 siblings, 0 replies; 70+ messages in thread
From: Uwe Kleine-König @ 2023-09-18 20:41 UTC (permalink / raw)
  To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: Yang Yingliang, Marc Kleine-Budde, netdev, kernel

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.
To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new() which already returns void. Eventually after all drivers
are converted, .remove_new() is renamed to .remove().

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/net/ethernet/dnet.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/dnet.c b/drivers/net/ethernet/dnet.c
index 151ca9573be9..2a18df3605f1 100644
--- a/drivers/net/ethernet/dnet.c
+++ b/drivers/net/ethernet/dnet.c
@@ -841,7 +841,7 @@ static int dnet_probe(struct platform_device *pdev)
 	return err;
 }
 
-static int dnet_remove(struct platform_device *pdev)
+static void dnet_remove(struct platform_device *pdev)
 {
 
 	struct net_device *dev;
@@ -859,13 +859,11 @@ static int dnet_remove(struct platform_device *pdev)
 		free_irq(dev->irq, dev);
 		free_netdev(dev);
 	}
-
-	return 0;
 }
 
 static struct platform_driver dnet_driver = {
 	.probe		= dnet_probe,
-	.remove		= dnet_remove,
+	.remove_new	= dnet_remove,
 	.driver		= {
 		.name		= "dnet",
 	},
-- 
2.40.1


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

* [PATCH net-next 19/54] net: ethernet: engleder: Convert to platform remove callback returning void
  2023-09-18 20:41 [PATCH net-next 00/54] net: ethernet: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (17 preceding siblings ...)
  2023-09-18 20:41 ` [PATCH net-next 18/54] net: ethernet: dnet: " Uwe Kleine-König
@ 2023-09-18 20:41 ` Uwe Kleine-König
  2023-09-18 20:41 ` [PATCH net-next 20/54] net: ethernet: ethoc: " Uwe Kleine-König
                   ` (35 subsequent siblings)
  54 siblings, 0 replies; 70+ messages in thread
From: Uwe Kleine-König @ 2023-09-18 20:41 UTC (permalink / raw)
  To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: Gerhard Engleder, Maciej Fijalkowski, Alexander Duyck, netdev,
	kernel

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.
To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new() which already returns void. Eventually after all drivers
are converted, .remove_new() is renamed to .remove().

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/net/ethernet/engleder/tsnep_main.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/engleder/tsnep_main.c b/drivers/net/ethernet/engleder/tsnep_main.c
index f61bd89734c5..c32c65b20d5d 100644
--- a/drivers/net/ethernet/engleder/tsnep_main.c
+++ b/drivers/net/ethernet/engleder/tsnep_main.c
@@ -2577,7 +2577,7 @@ static int tsnep_probe(struct platform_device *pdev)
 	return retval;
 }
 
-static int tsnep_remove(struct platform_device *pdev)
+static void tsnep_remove(struct platform_device *pdev)
 {
 	struct tsnep_adapter *adapter = platform_get_drvdata(pdev);
 
@@ -2593,8 +2593,6 @@ static int tsnep_remove(struct platform_device *pdev)
 		mdiobus_unregister(adapter->mdiobus);
 
 	tsnep_disable_irq(adapter, ECM_INT_ALL);
-
-	return 0;
 }
 
 static const struct of_device_id tsnep_of_match[] = {
@@ -2609,7 +2607,7 @@ static struct platform_driver tsnep_driver = {
 		.of_match_table = tsnep_of_match,
 	},
 	.probe = tsnep_probe,
-	.remove = tsnep_remove,
+	.remove_new = tsnep_remove,
 };
 module_platform_driver(tsnep_driver);
 
-- 
2.40.1


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

* [PATCH net-next 20/54] net: ethernet: ethoc: Convert to platform remove callback returning void
  2023-09-18 20:41 [PATCH net-next 00/54] net: ethernet: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (18 preceding siblings ...)
  2023-09-18 20:41 ` [PATCH net-next 19/54] net: ethernet: engleder: " Uwe Kleine-König
@ 2023-09-18 20:41 ` Uwe Kleine-König
  2023-09-18 20:41 ` [PATCH net-next 21/54] net: ethernet: faraday: " Uwe Kleine-König
                   ` (34 subsequent siblings)
  54 siblings, 0 replies; 70+ messages in thread
From: Uwe Kleine-König @ 2023-09-18 20:41 UTC (permalink / raw)
  To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: Marc Kleine-Budde, netdev, kernel

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.
To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new() which already returns void. Eventually after all drivers
are converted, .remove_new() is renamed to .remove().

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/net/ethernet/ethoc.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/ethoc.c b/drivers/net/ethernet/ethoc.c
index 95cbad198b4b..ad41c9019018 100644
--- a/drivers/net/ethernet/ethoc.c
+++ b/drivers/net/ethernet/ethoc.c
@@ -1254,7 +1254,7 @@ static int ethoc_probe(struct platform_device *pdev)
  * ethoc_remove - shutdown OpenCores ethernet MAC
  * @pdev:	platform device
  */
-static int ethoc_remove(struct platform_device *pdev)
+static void ethoc_remove(struct platform_device *pdev)
 {
 	struct net_device *netdev = platform_get_drvdata(pdev);
 	struct ethoc *priv = netdev_priv(netdev);
@@ -1271,8 +1271,6 @@ static int ethoc_remove(struct platform_device *pdev)
 		unregister_netdev(netdev);
 		free_netdev(netdev);
 	}
-
-	return 0;
 }
 
 #ifdef CONFIG_PM
@@ -1298,7 +1296,7 @@ MODULE_DEVICE_TABLE(of, ethoc_match);
 
 static struct platform_driver ethoc_driver = {
 	.probe   = ethoc_probe,
-	.remove  = ethoc_remove,
+	.remove_new = ethoc_remove,
 	.suspend = ethoc_suspend,
 	.resume  = ethoc_resume,
 	.driver  = {
-- 
2.40.1


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

* [PATCH net-next 21/54] net: ethernet: faraday: Convert to platform remove callback returning void
  2023-09-18 20:41 [PATCH net-next 00/54] net: ethernet: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (19 preceding siblings ...)
  2023-09-18 20:41 ` [PATCH net-next 20/54] net: ethernet: ethoc: " Uwe Kleine-König
@ 2023-09-18 20:41 ` Uwe Kleine-König
  2023-09-18 20:41 ` [PATCH net-next 22/54] net: ethernet: hisilicon: " Uwe Kleine-König
                   ` (33 subsequent siblings)
  54 siblings, 0 replies; 70+ messages in thread
From: Uwe Kleine-König @ 2023-09-18 20:41 UTC (permalink / raw)
  To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: Paul Fertser, Marc Kleine-Budde, Sergei Antonov, Vladimir Oltean,
	netdev, kernel

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.
To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new() which already returns void. Eventually after all drivers
are converted, .remove_new() is renamed to .remove().

Trivially convert these drivers from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/net/ethernet/faraday/ftgmac100.c | 5 ++---
 drivers/net/ethernet/faraday/ftmac100.c  | 5 ++---
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ethernet/faraday/ftgmac100.c b/drivers/net/ethernet/faraday/ftgmac100.c
index 9135b918dd49..fddfd1dd5070 100644
--- a/drivers/net/ethernet/faraday/ftgmac100.c
+++ b/drivers/net/ethernet/faraday/ftgmac100.c
@@ -2012,7 +2012,7 @@ static int ftgmac100_probe(struct platform_device *pdev)
 	return err;
 }
 
-static int ftgmac100_remove(struct platform_device *pdev)
+static void ftgmac100_remove(struct platform_device *pdev)
 {
 	struct net_device *netdev;
 	struct ftgmac100 *priv;
@@ -2040,7 +2040,6 @@ static int ftgmac100_remove(struct platform_device *pdev)
 
 	netif_napi_del(&priv->napi);
 	free_netdev(netdev);
-	return 0;
 }
 
 static const struct of_device_id ftgmac100_of_match[] = {
@@ -2051,7 +2050,7 @@ MODULE_DEVICE_TABLE(of, ftgmac100_of_match);
 
 static struct platform_driver ftgmac100_driver = {
 	.probe	= ftgmac100_probe,
-	.remove	= ftgmac100_remove,
+	.remove_new = ftgmac100_remove,
 	.driver	= {
 		.name		= DRV_NAME,
 		.of_match_table	= ftgmac100_of_match,
diff --git a/drivers/net/ethernet/faraday/ftmac100.c b/drivers/net/ethernet/faraday/ftmac100.c
index 183069581bc0..003bc9a45c65 100644
--- a/drivers/net/ethernet/faraday/ftmac100.c
+++ b/drivers/net/ethernet/faraday/ftmac100.c
@@ -1219,7 +1219,7 @@ static int ftmac100_probe(struct platform_device *pdev)
 	return err;
 }
 
-static int ftmac100_remove(struct platform_device *pdev)
+static void ftmac100_remove(struct platform_device *pdev)
 {
 	struct net_device *netdev;
 	struct ftmac100 *priv;
@@ -1234,7 +1234,6 @@ static int ftmac100_remove(struct platform_device *pdev)
 
 	netif_napi_del(&priv->napi);
 	free_netdev(netdev);
-	return 0;
 }
 
 static const struct of_device_id ftmac100_of_ids[] = {
@@ -1244,7 +1243,7 @@ static const struct of_device_id ftmac100_of_ids[] = {
 
 static struct platform_driver ftmac100_driver = {
 	.probe		= ftmac100_probe,
-	.remove		= ftmac100_remove,
+	.remove_new	= ftmac100_remove,
 	.driver		= {
 		.name	= DRV_NAME,
 		.of_match_table = ftmac100_of_ids
-- 
2.40.1


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

* [PATCH net-next 22/54] net: ethernet: hisilicon: Convert to platform remove callback returning void
  2023-09-18 20:41 [PATCH net-next 00/54] net: ethernet: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (20 preceding siblings ...)
  2023-09-18 20:41 ` [PATCH net-next 21/54] net: ethernet: faraday: " Uwe Kleine-König
@ 2023-09-18 20:41 ` Uwe Kleine-König
  2023-09-18 20:41 ` [PATCH net-next 23/54] net: ethernet: i825xx: " Uwe Kleine-König
                   ` (32 subsequent siblings)
  54 siblings, 0 replies; 70+ messages in thread
From: Uwe Kleine-König @ 2023-09-18 20:41 UTC (permalink / raw)
  To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: Yisen Zhuang, Salil Mehta, Marc Kleine-Budde, netdev, kernel

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.
To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new() which already returns void. Eventually after all drivers
are converted, .remove_new() is renamed to .remove().

Trivially convert these drivers from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/net/ethernet/hisilicon/hip04_eth.c         | 6 ++----
 drivers/net/ethernet/hisilicon/hisi_femac.c        | 6 ++----
 drivers/net/ethernet/hisilicon/hix5hd2_gmac.c      | 6 ++----
 drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c | 6 ++----
 drivers/net/ethernet/hisilicon/hns/hns_enet.c      | 5 ++---
 drivers/net/ethernet/hisilicon/hns_mdio.c          | 5 ++---
 6 files changed, 12 insertions(+), 22 deletions(-)

diff --git a/drivers/net/ethernet/hisilicon/hip04_eth.c b/drivers/net/ethernet/hisilicon/hip04_eth.c
index ecf92a5d56bb..b91e7a06b97f 100644
--- a/drivers/net/ethernet/hisilicon/hip04_eth.c
+++ b/drivers/net/ethernet/hisilicon/hip04_eth.c
@@ -1021,7 +1021,7 @@ static int hip04_mac_probe(struct platform_device *pdev)
 	return ret;
 }
 
-static int hip04_remove(struct platform_device *pdev)
+static void hip04_remove(struct platform_device *pdev)
 {
 	struct net_device *ndev = platform_get_drvdata(pdev);
 	struct hip04_priv *priv = netdev_priv(ndev);
@@ -1035,8 +1035,6 @@ static int hip04_remove(struct platform_device *pdev)
 	of_node_put(priv->phy_node);
 	cancel_work_sync(&priv->tx_timeout_task);
 	free_netdev(ndev);
-
-	return 0;
 }
 
 static const struct of_device_id hip04_mac_match[] = {
@@ -1048,7 +1046,7 @@ MODULE_DEVICE_TABLE(of, hip04_mac_match);
 
 static struct platform_driver hip04_mac_driver = {
 	.probe	= hip04_mac_probe,
-	.remove	= hip04_remove,
+	.remove_new = hip04_remove,
 	.driver	= {
 		.name		= DRV_NAME,
 		.of_match_table	= hip04_mac_match,
diff --git a/drivers/net/ethernet/hisilicon/hisi_femac.c b/drivers/net/ethernet/hisilicon/hisi_femac.c
index cb7b0293fe85..2406263c9dd3 100644
--- a/drivers/net/ethernet/hisilicon/hisi_femac.c
+++ b/drivers/net/ethernet/hisilicon/hisi_femac.c
@@ -893,7 +893,7 @@ static int hisi_femac_drv_probe(struct platform_device *pdev)
 	return ret;
 }
 
-static int hisi_femac_drv_remove(struct platform_device *pdev)
+static void hisi_femac_drv_remove(struct platform_device *pdev)
 {
 	struct net_device *ndev = platform_get_drvdata(pdev);
 	struct hisi_femac_priv *priv = netdev_priv(ndev);
@@ -904,8 +904,6 @@ static int hisi_femac_drv_remove(struct platform_device *pdev)
 	phy_disconnect(ndev->phydev);
 	clk_disable_unprepare(priv->clk);
 	free_netdev(ndev);
-
-	return 0;
 }
 
 #ifdef CONFIG_PM
@@ -961,7 +959,7 @@ static struct platform_driver hisi_femac_driver = {
 		.of_match_table = hisi_femac_match,
 	},
 	.probe = hisi_femac_drv_probe,
-	.remove = hisi_femac_drv_remove,
+	.remove_new = hisi_femac_drv_remove,
 #ifdef CONFIG_PM
 	.suspend = hisi_femac_drv_suspend,
 	.resume = hisi_femac_drv_resume,
diff --git a/drivers/net/ethernet/hisilicon/hix5hd2_gmac.c b/drivers/net/ethernet/hisilicon/hix5hd2_gmac.c
index 26d22bb04b87..506fa3d8bbee 100644
--- a/drivers/net/ethernet/hisilicon/hix5hd2_gmac.c
+++ b/drivers/net/ethernet/hisilicon/hix5hd2_gmac.c
@@ -1282,7 +1282,7 @@ static int hix5hd2_dev_probe(struct platform_device *pdev)
 	return ret;
 }
 
-static int hix5hd2_dev_remove(struct platform_device *pdev)
+static void hix5hd2_dev_remove(struct platform_device *pdev)
 {
 	struct net_device *ndev = platform_get_drvdata(pdev);
 	struct hix5hd2_priv *priv = netdev_priv(ndev);
@@ -1298,8 +1298,6 @@ static int hix5hd2_dev_remove(struct platform_device *pdev)
 	of_node_put(priv->phy_node);
 	cancel_work_sync(&priv->tx_timeout_task);
 	free_netdev(ndev);
-
-	return 0;
 }
 
 static const struct of_device_id hix5hd2_of_match[] = {
@@ -1319,7 +1317,7 @@ static struct platform_driver hix5hd2_dev_driver = {
 		.of_match_table = hix5hd2_of_match,
 	},
 	.probe = hix5hd2_dev_probe,
-	.remove = hix5hd2_dev_remove,
+	.remove_new = hix5hd2_dev_remove,
 };
 
 module_platform_driver(hix5hd2_dev_driver);
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c
index fcaf5132b865..1b67da1f6fa8 100644
--- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c
+++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c
@@ -3007,7 +3007,7 @@ static int hns_dsaf_probe(struct platform_device *pdev)
  * hns_dsaf_remove - remove dsaf dev
  * @pdev: dasf platform device
  */
-static int hns_dsaf_remove(struct platform_device *pdev)
+static void hns_dsaf_remove(struct platform_device *pdev)
 {
 	struct dsaf_device *dsaf_dev = dev_get_drvdata(&pdev->dev);
 
@@ -3020,8 +3020,6 @@ static int hns_dsaf_remove(struct platform_device *pdev)
 	hns_dsaf_free(dsaf_dev);
 
 	hns_dsaf_free_dev(dsaf_dev);
-
-	return 0;
 }
 
 static const struct of_device_id g_dsaf_match[] = {
@@ -3033,7 +3031,7 @@ MODULE_DEVICE_TABLE(of, g_dsaf_match);
 
 static struct platform_driver g_dsaf_driver = {
 	.probe = hns_dsaf_probe,
-	.remove = hns_dsaf_remove,
+	.remove_new = hns_dsaf_remove,
 	.driver = {
 		.name = DSAF_DRV_NAME,
 		.of_match_table = g_dsaf_match,
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_enet.c b/drivers/net/ethernet/hisilicon/hns/hns_enet.c
index 7cf10d1e2b31..0900abf5c508 100644
--- a/drivers/net/ethernet/hisilicon/hns/hns_enet.c
+++ b/drivers/net/ethernet/hisilicon/hns/hns_enet.c
@@ -2384,7 +2384,7 @@ static int hns_nic_dev_probe(struct platform_device *pdev)
 	return ret;
 }
 
-static int hns_nic_dev_remove(struct platform_device *pdev)
+static void hns_nic_dev_remove(struct platform_device *pdev)
 {
 	struct net_device *ndev = platform_get_drvdata(pdev);
 	struct hns_nic_priv *priv = netdev_priv(ndev);
@@ -2413,7 +2413,6 @@ static int hns_nic_dev_remove(struct platform_device *pdev)
 	of_node_put(to_of_node(priv->fwnode));
 
 	free_netdev(ndev);
-	return 0;
 }
 
 static const struct of_device_id hns_enet_of_match[] = {
@@ -2431,7 +2430,7 @@ static struct platform_driver hns_nic_dev_driver = {
 		.acpi_match_table = ACPI_PTR(hns_enet_acpi_match),
 	},
 	.probe = hns_nic_dev_probe,
-	.remove = hns_nic_dev_remove,
+	.remove_new = hns_nic_dev_remove,
 };
 
 module_platform_driver(hns_nic_dev_driver);
diff --git a/drivers/net/ethernet/hisilicon/hns_mdio.c b/drivers/net/ethernet/hisilicon/hns_mdio.c
index 409a89d80220..ed73707176c1 100644
--- a/drivers/net/ethernet/hisilicon/hns_mdio.c
+++ b/drivers/net/ethernet/hisilicon/hns_mdio.c
@@ -610,7 +610,7 @@ static int hns_mdio_probe(struct platform_device *pdev)
  *
  * Return 0 on success, negative on failure
  */
-static int hns_mdio_remove(struct platform_device *pdev)
+static void hns_mdio_remove(struct platform_device *pdev)
 {
 	struct mii_bus *bus;
 
@@ -618,7 +618,6 @@ static int hns_mdio_remove(struct platform_device *pdev)
 
 	mdiobus_unregister(bus);
 	platform_set_drvdata(pdev, NULL);
-	return 0;
 }
 
 static const struct of_device_id hns_mdio_match[] = {
@@ -636,7 +635,7 @@ MODULE_DEVICE_TABLE(acpi, hns_mdio_acpi_match);
 
 static struct platform_driver hns_mdio_driver = {
 	.probe = hns_mdio_probe,
-	.remove = hns_mdio_remove,
+	.remove_new = hns_mdio_remove,
 	.driver = {
 		   .name = MDIO_DRV_NAME,
 		   .of_match_table = hns_mdio_match,
-- 
2.40.1


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

* [PATCH net-next 23/54] net: ethernet: i825xx: Convert to platform remove callback returning void
  2023-09-18 20:41 [PATCH net-next 00/54] net: ethernet: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (21 preceding siblings ...)
  2023-09-18 20:41 ` [PATCH net-next 22/54] net: ethernet: hisilicon: " Uwe Kleine-König
@ 2023-09-18 20:41 ` Uwe Kleine-König
  2023-09-18 20:41 ` [PATCH net-next 24/54] net: ethernet: ibm: " Uwe Kleine-König
                   ` (31 subsequent siblings)
  54 siblings, 0 replies; 70+ messages in thread
From: Uwe Kleine-König @ 2023-09-18 20:41 UTC (permalink / raw)
  To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: Thomas Bogendoerfer, Michal Kubiak, netdev, kernel

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.
To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new() which already returns void. Eventually after all drivers
are converted, .remove_new() is renamed to .remove().

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/net/ethernet/i825xx/sni_82596.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/i825xx/sni_82596.c b/drivers/net/ethernet/i825xx/sni_82596.c
index 54bb4d9a0d1e..813403c2628f 100644
--- a/drivers/net/ethernet/i825xx/sni_82596.c
+++ b/drivers/net/ethernet/i825xx/sni_82596.c
@@ -153,7 +153,7 @@ static int sni_82596_probe(struct platform_device *dev)
 	return retval;
 }
 
-static int sni_82596_driver_remove(struct platform_device *pdev)
+static void sni_82596_driver_remove(struct platform_device *pdev)
 {
 	struct net_device *dev = platform_get_drvdata(pdev);
 	struct i596_private *lp = netdev_priv(dev);
@@ -164,12 +164,11 @@ static int sni_82596_driver_remove(struct platform_device *pdev)
 	iounmap(lp->ca);
 	iounmap(lp->mpu_port);
 	free_netdev (dev);
-	return 0;
 }
 
 static struct platform_driver sni_82596_driver = {
 	.probe	= sni_82596_probe,
-	.remove	= sni_82596_driver_remove,
+	.remove_new = sni_82596_driver_remove,
 	.driver	= {
 		.name	= sni_82596_string,
 	},
-- 
2.40.1


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

* [PATCH net-next 24/54] net: ethernet: ibm: Convert to platform remove callback returning void
  2023-09-18 20:41 [PATCH net-next 00/54] net: ethernet: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (22 preceding siblings ...)
  2023-09-18 20:41 ` [PATCH net-next 23/54] net: ethernet: i825xx: " Uwe Kleine-König
@ 2023-09-18 20:41 ` Uwe Kleine-König
  2023-09-18 20:41 ` [PATCH net-next 25/54] net: ethernet: korina: " Uwe Kleine-König
                   ` (30 subsequent siblings)
  54 siblings, 0 replies; 70+ messages in thread
From: Uwe Kleine-König @ 2023-09-18 20:41 UTC (permalink / raw)
  To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: Douglas Miller, Simon Horman, Rob Herring, Wei Fang,
	Marc Kleine-Budde, Yang Yingliang, Bhupesh Sharma, Nicolas Ferre,
	Alex Elder, netdev, kernel

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.
To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new() which already returns void. Eventually after all drivers
are converted, .remove_new() is renamed to .remove().

Trivially convert these drivers from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/net/ethernet/ibm/ehea/ehea_main.c | 8 +++-----
 drivers/net/ethernet/ibm/emac/core.c      | 6 ++----
 drivers/net/ethernet/ibm/emac/mal.c       | 6 ++----
 drivers/net/ethernet/ibm/emac/rgmii.c     | 6 ++----
 drivers/net/ethernet/ibm/emac/tah.c       | 6 ++----
 drivers/net/ethernet/ibm/emac/zmii.c      | 6 ++----
 6 files changed, 13 insertions(+), 25 deletions(-)

diff --git a/drivers/net/ethernet/ibm/ehea/ehea_main.c b/drivers/net/ethernet/ibm/ehea/ehea_main.c
index 0a56e9752464..251dedd55cfb 100644
--- a/drivers/net/ethernet/ibm/ehea/ehea_main.c
+++ b/drivers/net/ethernet/ibm/ehea/ehea_main.c
@@ -90,7 +90,7 @@ static struct ehea_bcmc_reg_array ehea_bcmc_regs;
 
 static int ehea_probe_adapter(struct platform_device *dev);
 
-static int ehea_remove(struct platform_device *dev);
+static void ehea_remove(struct platform_device *dev);
 
 static const struct of_device_id ehea_module_device_table[] = {
 	{
@@ -121,7 +121,7 @@ static struct platform_driver ehea_driver = {
 		.of_match_table = ehea_device_table,
 	},
 	.probe = ehea_probe_adapter,
-	.remove = ehea_remove,
+	.remove_new = ehea_remove,
 };
 
 void ehea_dump(void *adr, int len, char *msg)
@@ -3471,7 +3471,7 @@ static int ehea_probe_adapter(struct platform_device *dev)
 	return ret;
 }
 
-static int ehea_remove(struct platform_device *dev)
+static void ehea_remove(struct platform_device *dev)
 {
 	struct ehea_adapter *adapter = platform_get_drvdata(dev);
 	int i;
@@ -3492,8 +3492,6 @@ static int ehea_remove(struct platform_device *dev)
 	list_del(&adapter->list);
 
 	ehea_update_firmware_handles();
-
-	return 0;
 }
 
 static int check_module_parm(void)
diff --git a/drivers/net/ethernet/ibm/emac/core.c b/drivers/net/ethernet/ibm/emac/core.c
index 0c314bf97480..e6e47b1842ea 100644
--- a/drivers/net/ethernet/ibm/emac/core.c
+++ b/drivers/net/ethernet/ibm/emac/core.c
@@ -3253,7 +3253,7 @@ static int emac_probe(struct platform_device *ofdev)
 	return err;
 }
 
-static int emac_remove(struct platform_device *ofdev)
+static void emac_remove(struct platform_device *ofdev)
 {
 	struct emac_instance *dev = platform_get_drvdata(ofdev);
 
@@ -3290,8 +3290,6 @@ static int emac_remove(struct platform_device *ofdev)
 		irq_dispose_mapping(dev->emac_irq);
 
 	free_netdev(dev->ndev);
-
-	return 0;
 }
 
 /* XXX Features in here should be replaced by properties... */
@@ -3319,7 +3317,7 @@ static struct platform_driver emac_driver = {
 		.of_match_table = emac_match,
 	},
 	.probe = emac_probe,
-	.remove = emac_remove,
+	.remove_new = emac_remove,
 };
 
 static void __init emac_make_bootlist(void)
diff --git a/drivers/net/ethernet/ibm/emac/mal.c b/drivers/net/ethernet/ibm/emac/mal.c
index c3236b59e7e9..462646d1b817 100644
--- a/drivers/net/ethernet/ibm/emac/mal.c
+++ b/drivers/net/ethernet/ibm/emac/mal.c
@@ -711,7 +711,7 @@ static int mal_probe(struct platform_device *ofdev)
 	return err;
 }
 
-static int mal_remove(struct platform_device *ofdev)
+static void mal_remove(struct platform_device *ofdev)
 {
 	struct mal_instance *mal = platform_get_drvdata(ofdev);
 
@@ -740,8 +740,6 @@ static int mal_remove(struct platform_device *ofdev)
 			   NUM_RX_BUFF * mal->num_rx_chans), mal->bd_virt,
 			  mal->bd_dma);
 	kfree(mal);
-
-	return 0;
 }
 
 static const struct of_device_id mal_platform_match[] =
@@ -770,7 +768,7 @@ static struct platform_driver mal_of_driver = {
 		.of_match_table = mal_platform_match,
 	},
 	.probe = mal_probe,
-	.remove = mal_remove,
+	.remove_new = mal_remove,
 };
 
 int __init mal_init(void)
diff --git a/drivers/net/ethernet/ibm/emac/rgmii.c b/drivers/net/ethernet/ibm/emac/rgmii.c
index fd437f986edf..e1712fdc3c31 100644
--- a/drivers/net/ethernet/ibm/emac/rgmii.c
+++ b/drivers/net/ethernet/ibm/emac/rgmii.c
@@ -273,7 +273,7 @@ static int rgmii_probe(struct platform_device *ofdev)
 	return rc;
 }
 
-static int rgmii_remove(struct platform_device *ofdev)
+static void rgmii_remove(struct platform_device *ofdev)
 {
 	struct rgmii_instance *dev = platform_get_drvdata(ofdev);
 
@@ -281,8 +281,6 @@ static int rgmii_remove(struct platform_device *ofdev)
 
 	iounmap(dev->base);
 	kfree(dev);
-
-	return 0;
 }
 
 static const struct of_device_id rgmii_match[] =
@@ -302,7 +300,7 @@ static struct platform_driver rgmii_driver = {
 		.of_match_table = rgmii_match,
 	},
 	.probe = rgmii_probe,
-	.remove = rgmii_remove,
+	.remove_new = rgmii_remove,
 };
 
 int __init rgmii_init(void)
diff --git a/drivers/net/ethernet/ibm/emac/tah.c b/drivers/net/ethernet/ibm/emac/tah.c
index aae9a88d95d7..fa3488258ca2 100644
--- a/drivers/net/ethernet/ibm/emac/tah.c
+++ b/drivers/net/ethernet/ibm/emac/tah.c
@@ -130,7 +130,7 @@ static int tah_probe(struct platform_device *ofdev)
 	return rc;
 }
 
-static int tah_remove(struct platform_device *ofdev)
+static void tah_remove(struct platform_device *ofdev)
 {
 	struct tah_instance *dev = platform_get_drvdata(ofdev);
 
@@ -138,8 +138,6 @@ static int tah_remove(struct platform_device *ofdev)
 
 	iounmap(dev->base);
 	kfree(dev);
-
-	return 0;
 }
 
 static const struct of_device_id tah_match[] =
@@ -160,7 +158,7 @@ static struct platform_driver tah_driver = {
 		.of_match_table = tah_match,
 	},
 	.probe = tah_probe,
-	.remove = tah_remove,
+	.remove_new = tah_remove,
 };
 
 int __init tah_init(void)
diff --git a/drivers/net/ethernet/ibm/emac/zmii.c b/drivers/net/ethernet/ibm/emac/zmii.c
index 6337388ee5f4..26e86cdee2f6 100644
--- a/drivers/net/ethernet/ibm/emac/zmii.c
+++ b/drivers/net/ethernet/ibm/emac/zmii.c
@@ -278,7 +278,7 @@ static int zmii_probe(struct platform_device *ofdev)
 	return rc;
 }
 
-static int zmii_remove(struct platform_device *ofdev)
+static void zmii_remove(struct platform_device *ofdev)
 {
 	struct zmii_instance *dev = platform_get_drvdata(ofdev);
 
@@ -286,8 +286,6 @@ static int zmii_remove(struct platform_device *ofdev)
 
 	iounmap(dev->base);
 	kfree(dev);
-
-	return 0;
 }
 
 static const struct of_device_id zmii_match[] =
@@ -308,7 +306,7 @@ static struct platform_driver zmii_driver = {
 		.of_match_table = zmii_match,
 	},
 	.probe = zmii_probe,
-	.remove = zmii_remove,
+	.remove_new = zmii_remove,
 };
 
 int __init zmii_init(void)
-- 
2.40.1


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

* [PATCH net-next 25/54] net: ethernet: korina: Convert to platform remove callback returning void
  2023-09-18 20:41 [PATCH net-next 00/54] net: ethernet: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (23 preceding siblings ...)
  2023-09-18 20:41 ` [PATCH net-next 24/54] net: ethernet: ibm: " Uwe Kleine-König
@ 2023-09-18 20:41 ` Uwe Kleine-König
  2023-09-18 20:41 ` [PATCH net-next 26/54] net: ethernet: lantiq_etop: " Uwe Kleine-König
                   ` (29 subsequent siblings)
  54 siblings, 0 replies; 70+ messages in thread
From: Uwe Kleine-König @ 2023-09-18 20:41 UTC (permalink / raw)
  To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: Nathan Huckleberry, Nathan Chancellor, Simon Horman, Alex Elder,
	Rob Herring, Yuanjun Gong, netdev, kernel

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.
To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new() which already returns void. Eventually after all drivers
are converted, .remove_new() is renamed to .remove().

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/net/ethernet/korina.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/korina.c b/drivers/net/ethernet/korina.c
index 5f6ae11212ae..81cf3361a1e5 100644
--- a/drivers/net/ethernet/korina.c
+++ b/drivers/net/ethernet/korina.c
@@ -1380,13 +1380,11 @@ static int korina_probe(struct platform_device *pdev)
 	return rc;
 }
 
-static int korina_remove(struct platform_device *pdev)
+static void korina_remove(struct platform_device *pdev)
 {
 	struct net_device *dev = platform_get_drvdata(pdev);
 
 	unregister_netdev(dev);
-
-	return 0;
 }
 
 #ifdef CONFIG_OF
@@ -1405,7 +1403,7 @@ static struct platform_driver korina_driver = {
 		.of_match_table = of_match_ptr(korina_match),
 	},
 	.probe = korina_probe,
-	.remove = korina_remove,
+	.remove_new = korina_remove,
 };
 
 module_platform_driver(korina_driver);
-- 
2.40.1


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

* [PATCH net-next 26/54] net: ethernet: lantiq_etop: Convert to platform remove callback returning void
  2023-09-18 20:41 [PATCH net-next 00/54] net: ethernet: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (24 preceding siblings ...)
  2023-09-18 20:41 ` [PATCH net-next 25/54] net: ethernet: korina: " Uwe Kleine-König
@ 2023-09-18 20:41 ` Uwe Kleine-König
  2023-09-18 20:41 ` [PATCH net-next 27/54] net: ethernet: lantiq_xrx200: " Uwe Kleine-König
                   ` (28 subsequent siblings)
  54 siblings, 0 replies; 70+ messages in thread
From: Uwe Kleine-König @ 2023-09-18 20:41 UTC (permalink / raw)
  To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: Zhang Changzhong, netdev, kernel

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.
To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new() which already returns void. Eventually after all drivers
are converted, .remove_new() is renamed to .remove().

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/net/ethernet/lantiq_etop.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/lantiq_etop.c b/drivers/net/ethernet/lantiq_etop.c
index f5961bdcc480..1d5b7bb6380f 100644
--- a/drivers/net/ethernet/lantiq_etop.c
+++ b/drivers/net/ethernet/lantiq_etop.c
@@ -721,8 +721,7 @@ ltq_etop_probe(struct platform_device *pdev)
 	return err;
 }
 
-static int
-ltq_etop_remove(struct platform_device *pdev)
+static void ltq_etop_remove(struct platform_device *pdev)
 {
 	struct net_device *dev = platform_get_drvdata(pdev);
 
@@ -732,11 +731,10 @@ ltq_etop_remove(struct platform_device *pdev)
 		ltq_etop_mdio_cleanup(dev);
 		unregister_netdev(dev);
 	}
-	return 0;
 }
 
 static struct platform_driver ltq_mii_driver = {
-	.remove = ltq_etop_remove,
+	.remove_new = ltq_etop_remove,
 	.driver = {
 		.name = "ltq_etop",
 	},
-- 
2.40.1


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

* [PATCH net-next 27/54] net: ethernet: lantiq_xrx200: Convert to platform remove callback returning void
  2023-09-18 20:41 [PATCH net-next 00/54] net: ethernet: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (25 preceding siblings ...)
  2023-09-18 20:41 ` [PATCH net-next 26/54] net: ethernet: lantiq_etop: " Uwe Kleine-König
@ 2023-09-18 20:41 ` Uwe Kleine-König
  2023-09-18 20:42 ` [PATCH net-next 28/54] net: ethernet: litex: " Uwe Kleine-König
                   ` (27 subsequent siblings)
  54 siblings, 0 replies; 70+ messages in thread
From: Uwe Kleine-König @ 2023-09-18 20:41 UTC (permalink / raw)
  To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: Hauke Mehrtens, netdev, kernel

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.
To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new() which already returns void. Eventually after all drivers
are converted, .remove_new() is renamed to .remove().

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/net/ethernet/lantiq_xrx200.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/lantiq_xrx200.c b/drivers/net/ethernet/lantiq_xrx200.c
index 8d646c7f8c82..8bd4def3622e 100644
--- a/drivers/net/ethernet/lantiq_xrx200.c
+++ b/drivers/net/ethernet/lantiq_xrx200.c
@@ -641,7 +641,7 @@ static int xrx200_probe(struct platform_device *pdev)
 	return err;
 }
 
-static int xrx200_remove(struct platform_device *pdev)
+static void xrx200_remove(struct platform_device *pdev)
 {
 	struct xrx200_priv *priv = platform_get_drvdata(pdev);
 	struct net_device *net_dev = priv->net_dev;
@@ -659,8 +659,6 @@ static int xrx200_remove(struct platform_device *pdev)
 
 	/* shut down hardware */
 	xrx200_hw_cleanup(priv);
-
-	return 0;
 }
 
 static const struct of_device_id xrx200_match[] = {
@@ -671,7 +669,7 @@ MODULE_DEVICE_TABLE(of, xrx200_match);
 
 static struct platform_driver xrx200_driver = {
 	.probe = xrx200_probe,
-	.remove = xrx200_remove,
+	.remove_new = xrx200_remove,
 	.driver = {
 		.name = "lantiq,xrx200-net",
 		.of_match_table = xrx200_match,
-- 
2.40.1


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

* [PATCH net-next 28/54] net: ethernet: litex: Convert to platform remove callback returning void
  2023-09-18 20:41 [PATCH net-next 00/54] net: ethernet: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (26 preceding siblings ...)
  2023-09-18 20:41 ` [PATCH net-next 27/54] net: ethernet: lantiq_xrx200: " Uwe Kleine-König
@ 2023-09-18 20:42 ` Uwe Kleine-König
  2023-09-18 20:54   ` Gabriel L. Somlo
  2023-09-18 20:42 ` [PATCH net-next 29/54] net: ethernet: marvell: " Uwe Kleine-König
                   ` (26 subsequent siblings)
  54 siblings, 1 reply; 70+ messages in thread
From: Uwe Kleine-König @ 2023-09-18 20:42 UTC (permalink / raw)
  To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: Karol Gugala, Mateusz Holenko, Gabriel Somlo, Joel Stanley,
	netdev, kernel

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.
To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new() which already returns void. Eventually after all drivers
are converted, .remove_new() is renamed to .remove().

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/net/ethernet/litex/litex_liteeth.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/litex/litex_liteeth.c b/drivers/net/ethernet/litex/litex_liteeth.c
index ffa96059079c..5182fe737c37 100644
--- a/drivers/net/ethernet/litex/litex_liteeth.c
+++ b/drivers/net/ethernet/litex/litex_liteeth.c
@@ -294,13 +294,11 @@ static int liteeth_probe(struct platform_device *pdev)
 	return 0;
 }
 
-static int liteeth_remove(struct platform_device *pdev)
+static void liteeth_remove(struct platform_device *pdev)
 {
 	struct net_device *netdev = platform_get_drvdata(pdev);
 
 	unregister_netdev(netdev);
-
-	return 0;
 }
 
 static const struct of_device_id liteeth_of_match[] = {
@@ -311,7 +309,7 @@ MODULE_DEVICE_TABLE(of, liteeth_of_match);
 
 static struct platform_driver liteeth_driver = {
 	.probe = liteeth_probe,
-	.remove = liteeth_remove,
+	.remove_new = liteeth_remove,
 	.driver = {
 		.name = DRV_NAME,
 		.of_match_table = liteeth_of_match,
-- 
2.40.1


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

* [PATCH net-next 29/54] net: ethernet: marvell: Convert to platform remove callback returning void
  2023-09-18 20:41 [PATCH net-next 00/54] net: ethernet: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (27 preceding siblings ...)
  2023-09-18 20:42 ` [PATCH net-next 28/54] net: ethernet: litex: " Uwe Kleine-König
@ 2023-09-18 20:42 ` Uwe Kleine-König
  2023-09-18 20:42 ` [PATCH net-next 30/54] net: ethernet: mediatek: " Uwe Kleine-König
                   ` (25 subsequent siblings)
  54 siblings, 0 replies; 70+ messages in thread
From: Uwe Kleine-König @ 2023-09-18 20:42 UTC (permalink / raw)
  To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: Sebastian Hesselbarth, Thomas Petazzoni, Marcin Wojtas,
	Russell King, Michael Walle, Simon Horman, Andrew Lunn,
	Russell King (Oracle), Krzysztof Kozlowski, Rob Herring, netdev,
	kernel

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.
To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new() which already returns void. Eventually after all drivers
are converted, .remove_new() is renamed to .remove().

Trivially convert these drivers from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/net/ethernet/marvell/mv643xx_eth.c      | 11 ++++-------
 drivers/net/ethernet/marvell/mvmdio.c           |  6 ++----
 drivers/net/ethernet/marvell/mvneta.c           |  6 ++----
 drivers/net/ethernet/marvell/mvneta_bm.c        |  6 ++----
 drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c |  8 +++-----
 drivers/net/ethernet/marvell/pxa168_eth.c       |  5 ++---
 6 files changed, 15 insertions(+), 27 deletions(-)

diff --git a/drivers/net/ethernet/marvell/mv643xx_eth.c b/drivers/net/ethernet/marvell/mv643xx_eth.c
index 3b129a1c3381..f0bdc06d253d 100644
--- a/drivers/net/ethernet/marvell/mv643xx_eth.c
+++ b/drivers/net/ethernet/marvell/mv643xx_eth.c
@@ -2892,19 +2892,18 @@ static int mv643xx_eth_shared_probe(struct platform_device *pdev)
 	return ret;
 }
 
-static int mv643xx_eth_shared_remove(struct platform_device *pdev)
+static void mv643xx_eth_shared_remove(struct platform_device *pdev)
 {
 	struct mv643xx_eth_shared_private *msp = platform_get_drvdata(pdev);
 
 	mv643xx_eth_shared_of_remove();
 	if (!IS_ERR(msp->clk))
 		clk_disable_unprepare(msp->clk);
-	return 0;
 }
 
 static struct platform_driver mv643xx_eth_shared_driver = {
 	.probe		= mv643xx_eth_shared_probe,
-	.remove		= mv643xx_eth_shared_remove,
+	.remove_new	= mv643xx_eth_shared_remove,
 	.driver = {
 		.name	= MV643XX_ETH_SHARED_NAME,
 		.of_match_table = of_match_ptr(mv643xx_eth_shared_ids),
@@ -3279,7 +3278,7 @@ static int mv643xx_eth_probe(struct platform_device *pdev)
 	return err;
 }
 
-static int mv643xx_eth_remove(struct platform_device *pdev)
+static void mv643xx_eth_remove(struct platform_device *pdev)
 {
 	struct mv643xx_eth_private *mp = platform_get_drvdata(pdev);
 	struct net_device *dev = mp->dev;
@@ -3293,8 +3292,6 @@ static int mv643xx_eth_remove(struct platform_device *pdev)
 		clk_disable_unprepare(mp->clk);
 
 	free_netdev(mp->dev);
-
-	return 0;
 }
 
 static void mv643xx_eth_shutdown(struct platform_device *pdev)
@@ -3311,7 +3308,7 @@ static void mv643xx_eth_shutdown(struct platform_device *pdev)
 
 static struct platform_driver mv643xx_eth_driver = {
 	.probe		= mv643xx_eth_probe,
-	.remove		= mv643xx_eth_remove,
+	.remove_new	= mv643xx_eth_remove,
 	.shutdown	= mv643xx_eth_shutdown,
 	.driver = {
 		.name	= MV643XX_ETH_NAME,
diff --git a/drivers/net/ethernet/marvell/mvmdio.c b/drivers/net/ethernet/marvell/mvmdio.c
index 674913184ebf..89f26402f8fb 100644
--- a/drivers/net/ethernet/marvell/mvmdio.c
+++ b/drivers/net/ethernet/marvell/mvmdio.c
@@ -388,7 +388,7 @@ static int orion_mdio_probe(struct platform_device *pdev)
 	return ret;
 }
 
-static int orion_mdio_remove(struct platform_device *pdev)
+static void orion_mdio_remove(struct platform_device *pdev)
 {
 	struct mii_bus *bus = platform_get_drvdata(pdev);
 	struct orion_mdio_dev *dev = bus->priv;
@@ -404,8 +404,6 @@ static int orion_mdio_remove(struct platform_device *pdev)
 		clk_disable_unprepare(dev->clk[i]);
 		clk_put(dev->clk[i]);
 	}
-
-	return 0;
 }
 
 static const struct of_device_id orion_mdio_match[] = {
@@ -426,7 +424,7 @@ MODULE_DEVICE_TABLE(acpi, orion_mdio_acpi_match);
 
 static struct platform_driver orion_mdio_driver = {
 	.probe = orion_mdio_probe,
-	.remove = orion_mdio_remove,
+	.remove_new = orion_mdio_remove,
 	.driver = {
 		.name = "orion-mdio",
 		.of_match_table = orion_mdio_match,
diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c
index d483b8c00ec0..61a430e5bc91 100644
--- a/drivers/net/ethernet/marvell/mvneta.c
+++ b/drivers/net/ethernet/marvell/mvneta.c
@@ -5725,7 +5725,7 @@ static int mvneta_probe(struct platform_device *pdev)
 }
 
 /* Device removal routine */
-static int mvneta_remove(struct platform_device *pdev)
+static void mvneta_remove(struct platform_device *pdev)
 {
 	struct net_device  *dev = platform_get_drvdata(pdev);
 	struct mvneta_port *pp = netdev_priv(dev);
@@ -5744,8 +5744,6 @@ static int mvneta_remove(struct platform_device *pdev)
 				       1 << pp->id);
 		mvneta_bm_put(pp->bm_priv);
 	}
-
-	return 0;
 }
 
 #ifdef CONFIG_PM_SLEEP
@@ -5871,7 +5869,7 @@ MODULE_DEVICE_TABLE(of, mvneta_match);
 
 static struct platform_driver mvneta_driver = {
 	.probe = mvneta_probe,
-	.remove = mvneta_remove,
+	.remove_new = mvneta_remove,
 	.driver = {
 		.name = MVNETA_DRIVER_NAME,
 		.of_match_table = mvneta_match,
diff --git a/drivers/net/ethernet/marvell/mvneta_bm.c b/drivers/net/ethernet/marvell/mvneta_bm.c
index 46c942ef2287..3f46a0fed048 100644
--- a/drivers/net/ethernet/marvell/mvneta_bm.c
+++ b/drivers/net/ethernet/marvell/mvneta_bm.c
@@ -457,7 +457,7 @@ static int mvneta_bm_probe(struct platform_device *pdev)
 	return err;
 }
 
-static int mvneta_bm_remove(struct platform_device *pdev)
+static void mvneta_bm_remove(struct platform_device *pdev)
 {
 	struct mvneta_bm *priv = platform_get_drvdata(pdev);
 	u8 all_ports_map = 0xff;
@@ -475,8 +475,6 @@ static int mvneta_bm_remove(struct platform_device *pdev)
 	mvneta_bm_write(priv, MVNETA_BM_COMMAND_REG, MVNETA_BM_STOP_MASK);
 
 	clk_disable_unprepare(priv->clk);
-
-	return 0;
 }
 
 static const struct of_device_id mvneta_bm_match[] = {
@@ -487,7 +485,7 @@ MODULE_DEVICE_TABLE(of, mvneta_bm_match);
 
 static struct platform_driver mvneta_bm_driver = {
 	.probe = mvneta_bm_probe,
-	.remove = mvneta_bm_remove,
+	.remove_new = mvneta_bm_remove,
 	.driver = {
 		.name = MVNETA_BM_DRIVER_NAME,
 		.of_match_table = mvneta_bm_match,
diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
index 21c3f9b015c8..463e89d3f17a 100644
--- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
+++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
@@ -7662,7 +7662,7 @@ static int mvpp2_probe(struct platform_device *pdev)
 	return err;
 }
 
-static int mvpp2_remove(struct platform_device *pdev)
+static void mvpp2_remove(struct platform_device *pdev)
 {
 	struct mvpp2 *priv = platform_get_drvdata(pdev);
 	struct fwnode_handle *fwnode = pdev->dev.fwnode;
@@ -7700,15 +7700,13 @@ static int mvpp2_remove(struct platform_device *pdev)
 	}
 
 	if (is_acpi_node(port_fwnode))
-		return 0;
+		return;
 
 	clk_disable_unprepare(priv->axi_clk);
 	clk_disable_unprepare(priv->mg_core_clk);
 	clk_disable_unprepare(priv->mg_clk);
 	clk_disable_unprepare(priv->pp_clk);
 	clk_disable_unprepare(priv->gop_clk);
-
-	return 0;
 }
 
 static const struct of_device_id mvpp2_match[] = {
@@ -7734,7 +7732,7 @@ MODULE_DEVICE_TABLE(acpi, mvpp2_acpi_match);
 
 static struct platform_driver mvpp2_driver = {
 	.probe = mvpp2_probe,
-	.remove = mvpp2_remove,
+	.remove_new = mvpp2_remove,
 	.driver = {
 		.name = MVPP2_DRIVER_NAME,
 		.of_match_table = mvpp2_match,
diff --git a/drivers/net/ethernet/marvell/pxa168_eth.c b/drivers/net/ethernet/marvell/pxa168_eth.c
index d5691b6a2bc5..dd6ca2e4fd51 100644
--- a/drivers/net/ethernet/marvell/pxa168_eth.c
+++ b/drivers/net/ethernet/marvell/pxa168_eth.c
@@ -1528,7 +1528,7 @@ static int pxa168_eth_probe(struct platform_device *pdev)
 	return err;
 }
 
-static int pxa168_eth_remove(struct platform_device *pdev)
+static void pxa168_eth_remove(struct platform_device *pdev)
 {
 	struct net_device *dev = platform_get_drvdata(pdev);
 	struct pxa168_eth_private *pep = netdev_priv(dev);
@@ -1547,7 +1547,6 @@ static int pxa168_eth_remove(struct platform_device *pdev)
 	mdiobus_free(pep->smi_bus);
 	unregister_netdev(dev);
 	free_netdev(dev);
-	return 0;
 }
 
 static void pxa168_eth_shutdown(struct platform_device *pdev)
@@ -1580,7 +1579,7 @@ MODULE_DEVICE_TABLE(of, pxa168_eth_of_match);
 
 static struct platform_driver pxa168_eth_driver = {
 	.probe = pxa168_eth_probe,
-	.remove = pxa168_eth_remove,
+	.remove_new = pxa168_eth_remove,
 	.shutdown = pxa168_eth_shutdown,
 	.resume = pxa168_eth_resume,
 	.suspend = pxa168_eth_suspend,
-- 
2.40.1


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

* [PATCH net-next 30/54] net: ethernet: mediatek: Convert to platform remove callback returning void
  2023-09-18 20:41 [PATCH net-next 00/54] net: ethernet: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (28 preceding siblings ...)
  2023-09-18 20:42 ` [PATCH net-next 29/54] net: ethernet: marvell: " Uwe Kleine-König
@ 2023-09-18 20:42 ` Uwe Kleine-König
  2023-09-18 20:42 ` [PATCH net-next 31/54] net: ethernet: mellanox: " Uwe Kleine-König
                   ` (24 subsequent siblings)
  54 siblings, 0 replies; 70+ messages in thread
From: Uwe Kleine-König @ 2023-09-18 20:42 UTC (permalink / raw)
  To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: Felix Fietkau, John Crispin, Sean Wang, Mark Lee,
	Lorenzo Bianconi, Matthias Brugger, AngeloGioacchino Del Regno,
	netdev, kernel, linux-arm-kernel, linux-mediatek

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.
To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new() which already returns void. Eventually after all drivers
are converted, .remove_new() is renamed to .remove().

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/net/ethernet/mediatek/mtk_eth_soc.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
index 3cffd1bd3067..4ac8d7cd97ae 100644
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
@@ -5002,7 +5002,7 @@ static int mtk_probe(struct platform_device *pdev)
 	return err;
 }
 
-static int mtk_remove(struct platform_device *pdev)
+static void mtk_remove(struct platform_device *pdev)
 {
 	struct mtk_eth *eth = platform_get_drvdata(pdev);
 	struct mtk_mac *mac;
@@ -5024,8 +5024,6 @@ static int mtk_remove(struct platform_device *pdev)
 	netif_napi_del(&eth->rx_napi);
 	mtk_cleanup(eth);
 	mtk_mdio_cleanup(eth);
-
-	return 0;
 }
 
 static const struct mtk_soc_data mt2701_data = {
@@ -5226,7 +5224,7 @@ MODULE_DEVICE_TABLE(of, of_mtk_match);
 
 static struct platform_driver mtk_driver = {
 	.probe = mtk_probe,
-	.remove = mtk_remove,
+	.remove_new = mtk_remove,
 	.driver = {
 		.name = "mtk_soc_eth",
 		.of_match_table = of_mtk_match,
-- 
2.40.1


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

* [PATCH net-next 31/54] net: ethernet: mellanox: Convert to platform remove callback returning void
  2023-09-18 20:41 [PATCH net-next 00/54] net: ethernet: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (29 preceding siblings ...)
  2023-09-18 20:42 ` [PATCH net-next 30/54] net: ethernet: mediatek: " Uwe Kleine-König
@ 2023-09-18 20:42 ` Uwe Kleine-König
  2023-09-19  8:21   ` Leon Romanovsky
  2023-09-18 20:42 ` [PATCH net-next 32/54] net: ethernet: micrel: " Uwe Kleine-König
                   ` (23 subsequent siblings)
  54 siblings, 1 reply; 70+ messages in thread
From: Uwe Kleine-König @ 2023-09-18 20:42 UTC (permalink / raw)
  To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: Asmaa Mnebhi, David Thompson, Andrew Lunn, netdev, kernel

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.
To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new() which already returns void. Eventually after all drivers
are converted, .remove_new() is renamed to .remove().

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_main.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_main.c b/drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_main.c
index 694de9513b9f..954ba0826c61 100644
--- a/drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_main.c
+++ b/drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_main.c
@@ -471,7 +471,7 @@ static int mlxbf_gige_probe(struct platform_device *pdev)
 	return err;
 }
 
-static int mlxbf_gige_remove(struct platform_device *pdev)
+static void mlxbf_gige_remove(struct platform_device *pdev)
 {
 	struct mlxbf_gige *priv = platform_get_drvdata(pdev);
 
@@ -479,8 +479,6 @@ static int mlxbf_gige_remove(struct platform_device *pdev)
 	phy_disconnect(priv->netdev->phydev);
 	mlxbf_gige_mdio_remove(priv);
 	platform_set_drvdata(pdev, NULL);
-
-	return 0;
 }
 
 static void mlxbf_gige_shutdown(struct platform_device *pdev)
@@ -499,7 +497,7 @@ MODULE_DEVICE_TABLE(acpi, mlxbf_gige_acpi_match);
 
 static struct platform_driver mlxbf_gige_driver = {
 	.probe = mlxbf_gige_probe,
-	.remove = mlxbf_gige_remove,
+	.remove_new = mlxbf_gige_remove,
 	.shutdown = mlxbf_gige_shutdown,
 	.driver = {
 		.name = KBUILD_MODNAME,
-- 
2.40.1


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

* [PATCH net-next 32/54] net: ethernet: micrel: Convert to platform remove callback returning void
  2023-09-18 20:41 [PATCH net-next 00/54] net: ethernet: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (30 preceding siblings ...)
  2023-09-18 20:42 ` [PATCH net-next 31/54] net: ethernet: mellanox: " Uwe Kleine-König
@ 2023-09-18 20:42 ` Uwe Kleine-König
  2023-09-18 20:42 ` [PATCH net-next 33/54] net: ethernet: microchip: " Uwe Kleine-König
                   ` (22 subsequent siblings)
  54 siblings, 0 replies; 70+ messages in thread
From: Uwe Kleine-König @ 2023-09-18 20:42 UTC (permalink / raw)
  To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni; +Cc: netdev, kernel

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.
To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new() which already returns void. Eventually after all drivers
are converted, .remove_new() is renamed to .remove().

Trivially convert these drivers from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/net/ethernet/micrel/ks8842.c     | 5 ++---
 drivers/net/ethernet/micrel/ks8851_par.c | 6 ++----
 2 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/net/ethernet/micrel/ks8842.c b/drivers/net/ethernet/micrel/ks8842.c
index c11b118dc415..ddd87ef71caf 100644
--- a/drivers/net/ethernet/micrel/ks8842.c
+++ b/drivers/net/ethernet/micrel/ks8842.c
@@ -1228,7 +1228,7 @@ static int ks8842_probe(struct platform_device *pdev)
 	return err;
 }
 
-static int ks8842_remove(struct platform_device *pdev)
+static void ks8842_remove(struct platform_device *pdev)
 {
 	struct net_device *netdev = platform_get_drvdata(pdev);
 	struct ks8842_adapter *adapter = netdev_priv(netdev);
@@ -1239,7 +1239,6 @@ static int ks8842_remove(struct platform_device *pdev)
 	iounmap(adapter->hw_addr);
 	free_netdev(netdev);
 	release_mem_region(iomem->start, resource_size(iomem));
-	return 0;
 }
 
 
@@ -1248,7 +1247,7 @@ static struct platform_driver ks8842_platform_driver = {
 		.name	= DRV_NAME,
 	},
 	.probe		= ks8842_probe,
-	.remove		= ks8842_remove,
+	.remove_new	= ks8842_remove,
 };
 
 module_platform_driver(ks8842_platform_driver);
diff --git a/drivers/net/ethernet/micrel/ks8851_par.c b/drivers/net/ethernet/micrel/ks8851_par.c
index 7f49042484bd..2a7f29854267 100644
--- a/drivers/net/ethernet/micrel/ks8851_par.c
+++ b/drivers/net/ethernet/micrel/ks8851_par.c
@@ -327,11 +327,9 @@ static int ks8851_probe_par(struct platform_device *pdev)
 	return ks8851_probe_common(netdev, dev, msg_enable);
 }
 
-static int ks8851_remove_par(struct platform_device *pdev)
+static void ks8851_remove_par(struct platform_device *pdev)
 {
 	ks8851_remove_common(&pdev->dev);
-
-	return 0;
 }
 
 static const struct of_device_id ks8851_match_table[] = {
@@ -347,7 +345,7 @@ static struct platform_driver ks8851_driver = {
 		.pm = &ks8851_pm_ops,
 	},
 	.probe = ks8851_probe_par,
-	.remove = ks8851_remove_par,
+	.remove_new = ks8851_remove_par,
 };
 module_platform_driver(ks8851_driver);
 
-- 
2.40.1


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

* [PATCH net-next 33/54] net: ethernet: microchip: Convert to platform remove callback returning void
  2023-09-18 20:41 [PATCH net-next 00/54] net: ethernet: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (31 preceding siblings ...)
  2023-09-18 20:42 ` [PATCH net-next 32/54] net: ethernet: micrel: " Uwe Kleine-König
@ 2023-09-18 20:42 ` Uwe Kleine-König
  2023-09-18 20:42 ` [PATCH net-next 34/54] net: ethernet: moxa:: " Uwe Kleine-König
                   ` (21 subsequent siblings)
  54 siblings, 0 replies; 70+ messages in thread
From: Uwe Kleine-König @ 2023-09-18 20:42 UTC (permalink / raw)
  To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: Horatiu Vultur, UNGLinuxDriver, Lars Povlsen, Steen Hegelund,
	Daniel Machon, Shang XiaoJing, Qiheng Lin, netdev, kernel,
	linux-arm-kernel

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.
To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new() which already returns void. Eventually after all drivers
are converted, .remove_new() is renamed to .remove().

Trivially convert these drivers from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/net/ethernet/microchip/lan966x/lan966x_main.c | 6 ++----
 drivers/net/ethernet/microchip/sparx5/sparx5_main.c   | 6 ++----
 2 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/drivers/net/ethernet/microchip/lan966x/lan966x_main.c b/drivers/net/ethernet/microchip/lan966x/lan966x_main.c
index 0d6e79af2410..8e4101628fbd 100644
--- a/drivers/net/ethernet/microchip/lan966x/lan966x_main.c
+++ b/drivers/net/ethernet/microchip/lan966x/lan966x_main.c
@@ -1261,7 +1261,7 @@ static int lan966x_probe(struct platform_device *pdev)
 	return err;
 }
 
-static int lan966x_remove(struct platform_device *pdev)
+static void lan966x_remove(struct platform_device *pdev)
 {
 	struct lan966x *lan966x = platform_get_drvdata(pdev);
 
@@ -1280,13 +1280,11 @@ static int lan966x_remove(struct platform_device *pdev)
 	lan966x_ptp_deinit(lan966x);
 
 	debugfs_remove_recursive(lan966x->debugfs_root);
-
-	return 0;
 }
 
 static struct platform_driver lan966x_driver = {
 	.probe = lan966x_probe,
-	.remove = lan966x_remove,
+	.remove_new = lan966x_remove,
 	.driver = {
 		.name = "lan966x-switch",
 		.of_match_table = lan966x_match,
diff --git a/drivers/net/ethernet/microchip/sparx5/sparx5_main.c b/drivers/net/ethernet/microchip/sparx5/sparx5_main.c
index dc9af480bfea..d1f7fc8b1b71 100644
--- a/drivers/net/ethernet/microchip/sparx5/sparx5_main.c
+++ b/drivers/net/ethernet/microchip/sparx5/sparx5_main.c
@@ -911,7 +911,7 @@ static int mchp_sparx5_probe(struct platform_device *pdev)
 	return err;
 }
 
-static int mchp_sparx5_remove(struct platform_device *pdev)
+static void mchp_sparx5_remove(struct platform_device *pdev)
 {
 	struct sparx5 *sparx5 = platform_get_drvdata(pdev);
 
@@ -931,8 +931,6 @@ static int mchp_sparx5_remove(struct platform_device *pdev)
 	/* Unregister netdevs */
 	sparx5_unregister_notifier_blocks(sparx5);
 	destroy_workqueue(sparx5->mact_queue);
-
-	return 0;
 }
 
 static const struct of_device_id mchp_sparx5_match[] = {
@@ -943,7 +941,7 @@ MODULE_DEVICE_TABLE(of, mchp_sparx5_match);
 
 static struct platform_driver mchp_sparx5_driver = {
 	.probe = mchp_sparx5_probe,
-	.remove = mchp_sparx5_remove,
+	.remove_new = mchp_sparx5_remove,
 	.driver = {
 		.name = "sparx5-switch",
 		.of_match_table = mchp_sparx5_match,
-- 
2.40.1


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

* [PATCH net-next 34/54] net: ethernet: moxa:: Convert to platform remove callback returning void
  2023-09-18 20:41 [PATCH net-next 00/54] net: ethernet: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (32 preceding siblings ...)
  2023-09-18 20:42 ` [PATCH net-next 33/54] net: ethernet: microchip: " Uwe Kleine-König
@ 2023-09-18 20:42 ` Uwe Kleine-König
  2023-09-18 20:42 ` [PATCH net-next 35/54] net: ethernet: mscc: " Uwe Kleine-König
                   ` (20 subsequent siblings)
  54 siblings, 0 replies; 70+ messages in thread
From: Uwe Kleine-König @ 2023-09-18 20:42 UTC (permalink / raw)
  To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni; +Cc: netdev, kernel

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.
To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new() which already returns void. Eventually after all drivers
are converted, .remove_new() is renamed to .remove().

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/net/ethernet/moxa/moxart_ether.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/moxa/moxart_ether.c b/drivers/net/ethernet/moxa/moxart_ether.c
index 3da99b62797d..96dc69e7141f 100644
--- a/drivers/net/ethernet/moxa/moxart_ether.c
+++ b/drivers/net/ethernet/moxa/moxart_ether.c
@@ -558,7 +558,7 @@ static int moxart_mac_probe(struct platform_device *pdev)
 	return ret;
 }
 
-static int moxart_remove(struct platform_device *pdev)
+static void moxart_remove(struct platform_device *pdev)
 {
 	struct net_device *ndev = platform_get_drvdata(pdev);
 
@@ -566,8 +566,6 @@ static int moxart_remove(struct platform_device *pdev)
 	devm_free_irq(&pdev->dev, ndev->irq, ndev);
 	moxart_mac_free_memory(ndev);
 	free_netdev(ndev);
-
-	return 0;
 }
 
 static const struct of_device_id moxart_mac_match[] = {
@@ -578,7 +576,7 @@ MODULE_DEVICE_TABLE(of, moxart_mac_match);
 
 static struct platform_driver moxart_mac_driver = {
 	.probe	= moxart_mac_probe,
-	.remove	= moxart_remove,
+	.remove_new = moxart_remove,
 	.driver	= {
 		.name		= "moxart-ethernet",
 		.of_match_table	= moxart_mac_match,
-- 
2.40.1


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

* [PATCH net-next 35/54] net: ethernet: mscc: Convert to platform remove callback returning void
  2023-09-18 20:41 [PATCH net-next 00/54] net: ethernet: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (33 preceding siblings ...)
  2023-09-18 20:42 ` [PATCH net-next 34/54] net: ethernet: moxa:: " Uwe Kleine-König
@ 2023-09-18 20:42 ` Uwe Kleine-König
  2023-09-18 20:42 ` [PATCH net-next 36/54] net: ethernet: natsemi: " Uwe Kleine-König
                   ` (19 subsequent siblings)
  54 siblings, 0 replies; 70+ messages in thread
From: Uwe Kleine-König @ 2023-09-18 20:42 UTC (permalink / raw)
  To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: Vladimir Oltean, Claudiu Manoil, Alexandre Belloni,
	UNGLinuxDriver, netdev, kernel

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.
To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new() which already returns void. Eventually after all drivers
are converted, .remove_new() is renamed to .remove().

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/net/ethernet/mscc/ocelot_vsc7514.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/mscc/ocelot_vsc7514.c b/drivers/net/ethernet/mscc/ocelot_vsc7514.c
index 151b42465348..993212c3a7da 100644
--- a/drivers/net/ethernet/mscc/ocelot_vsc7514.c
+++ b/drivers/net/ethernet/mscc/ocelot_vsc7514.c
@@ -392,7 +392,7 @@ static int mscc_ocelot_probe(struct platform_device *pdev)
 	return err;
 }
 
-static int mscc_ocelot_remove(struct platform_device *pdev)
+static void mscc_ocelot_remove(struct platform_device *pdev)
 {
 	struct ocelot *ocelot = platform_get_drvdata(pdev);
 
@@ -408,13 +408,11 @@ static int mscc_ocelot_remove(struct platform_device *pdev)
 	unregister_switchdev_notifier(&ocelot_switchdev_nb);
 	unregister_netdevice_notifier(&ocelot_netdevice_nb);
 	devlink_free(ocelot->devlink);
-
-	return 0;
 }
 
 static struct platform_driver mscc_ocelot_driver = {
 	.probe = mscc_ocelot_probe,
-	.remove = mscc_ocelot_remove,
+	.remove_new = mscc_ocelot_remove,
 	.driver = {
 		.name = "ocelot-switch",
 		.of_match_table = mscc_ocelot_match,
-- 
2.40.1


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

* [PATCH net-next 36/54] net: ethernet: natsemi: Convert to platform remove callback returning void
  2023-09-18 20:41 [PATCH net-next 00/54] net: ethernet: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (34 preceding siblings ...)
  2023-09-18 20:42 ` [PATCH net-next 35/54] net: ethernet: mscc: " Uwe Kleine-König
@ 2023-09-18 20:42 ` Uwe Kleine-König
  2023-09-18 20:42 ` [PATCH net-next 37/54] " Uwe Kleine-König
                   ` (18 subsequent siblings)
  54 siblings, 0 replies; 70+ messages in thread
From: Uwe Kleine-König @ 2023-09-18 20:42 UTC (permalink / raw)
  To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni; +Cc: netdev, kernel

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.
To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new() which already returns void. Eventually after all drivers
are converted, .remove_new() is renamed to .remove().

Trivially convert these drivers from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/net/ethernet/natsemi/jazzsonic.c | 6 ++----
 drivers/net/ethernet/natsemi/macsonic.c  | 6 ++----
 2 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/drivers/net/ethernet/natsemi/jazzsonic.c b/drivers/net/ethernet/natsemi/jazzsonic.c
index 3f371faeb6d0..2b6e097df28f 100644
--- a/drivers/net/ethernet/natsemi/jazzsonic.c
+++ b/drivers/net/ethernet/natsemi/jazzsonic.c
@@ -227,7 +227,7 @@ MODULE_ALIAS("platform:jazzsonic");
 
 #include "sonic.c"
 
-static int jazz_sonic_device_remove(struct platform_device *pdev)
+static void jazz_sonic_device_remove(struct platform_device *pdev)
 {
 	struct net_device *dev = platform_get_drvdata(pdev);
 	struct sonic_local* lp = netdev_priv(dev);
@@ -237,13 +237,11 @@ static int jazz_sonic_device_remove(struct platform_device *pdev)
 	                  lp->descriptors, lp->descriptors_laddr);
 	release_mem_region(dev->base_addr, SONIC_MEM_SIZE);
 	free_netdev(dev);
-
-	return 0;
 }
 
 static struct platform_driver jazz_sonic_driver = {
 	.probe	= jazz_sonic_probe,
-	.remove	= jazz_sonic_device_remove,
+	.remove_new = jazz_sonic_device_remove,
 	.driver	= {
 		.name	= jazz_sonic_string,
 	},
diff --git a/drivers/net/ethernet/natsemi/macsonic.c b/drivers/net/ethernet/natsemi/macsonic.c
index b16f7c830f9b..2fc63860dbdb 100644
--- a/drivers/net/ethernet/natsemi/macsonic.c
+++ b/drivers/net/ethernet/natsemi/macsonic.c
@@ -532,7 +532,7 @@ MODULE_ALIAS("platform:macsonic");
 
 #include "sonic.c"
 
-static int mac_sonic_platform_remove(struct platform_device *pdev)
+static void mac_sonic_platform_remove(struct platform_device *pdev)
 {
 	struct net_device *dev = platform_get_drvdata(pdev);
 	struct sonic_local* lp = netdev_priv(dev);
@@ -541,13 +541,11 @@ static int mac_sonic_platform_remove(struct platform_device *pdev)
 	dma_free_coherent(lp->device, SIZEOF_SONIC_DESC * SONIC_BUS_SCALE(lp->dma_bitmode),
 	                  lp->descriptors, lp->descriptors_laddr);
 	free_netdev(dev);
-
-	return 0;
 }
 
 static struct platform_driver mac_sonic_platform_driver = {
 	.probe  = mac_sonic_platform_probe,
-	.remove = mac_sonic_platform_remove,
+	.remove_new = mac_sonic_platform_remove,
 	.driver = {
 		.name = "macsonic",
 	},
-- 
2.40.1


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

* [PATCH net-next 37/54] net: ethernet: natsemi: Convert to platform remove callback returning void
  2023-09-18 20:41 [PATCH net-next 00/54] net: ethernet: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (35 preceding siblings ...)
  2023-09-18 20:42 ` [PATCH net-next 36/54] net: ethernet: natsemi: " Uwe Kleine-König
@ 2023-09-18 20:42 ` Uwe Kleine-König
  2023-09-18 20:42 ` [PATCH net-next 38/54] net: ethernet: ni: " Uwe Kleine-König
                   ` (17 subsequent siblings)
  54 siblings, 0 replies; 70+ messages in thread
From: Uwe Kleine-König @ 2023-09-18 20:42 UTC (permalink / raw)
  To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni; +Cc: netdev, kernel

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.
To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new() which already returns void. Eventually after all drivers
are converted, .remove_new() is renamed to .remove().

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/net/ethernet/natsemi/xtsonic.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/natsemi/xtsonic.c b/drivers/net/ethernet/natsemi/xtsonic.c
index 52fef34d43f9..8943e7244310 100644
--- a/drivers/net/ethernet/natsemi/xtsonic.c
+++ b/drivers/net/ethernet/natsemi/xtsonic.c
@@ -249,7 +249,7 @@ MODULE_DESCRIPTION("Xtensa XT2000 SONIC ethernet driver");
 
 #include "sonic.c"
 
-static int xtsonic_device_remove(struct platform_device *pdev)
+static void xtsonic_device_remove(struct platform_device *pdev)
 {
 	struct net_device *dev = platform_get_drvdata(pdev);
 	struct sonic_local *lp = netdev_priv(dev);
@@ -260,13 +260,11 @@ static int xtsonic_device_remove(struct platform_device *pdev)
 			  lp->descriptors, lp->descriptors_laddr);
 	release_region (dev->base_addr, SONIC_MEM_SIZE);
 	free_netdev(dev);
-
-	return 0;
 }
 
 static struct platform_driver xtsonic_driver = {
 	.probe = xtsonic_probe,
-	.remove = xtsonic_device_remove,
+	.remove_new = xtsonic_device_remove,
 	.driver = {
 		.name = xtsonic_string,
 	},
-- 
2.40.1


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

* [PATCH net-next 38/54] net: ethernet: ni: Convert to platform remove callback returning void
  2023-09-18 20:41 [PATCH net-next 00/54] net: ethernet: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (36 preceding siblings ...)
  2023-09-18 20:42 ` [PATCH net-next 37/54] " Uwe Kleine-König
@ 2023-09-18 20:42 ` Uwe Kleine-König
  2023-09-18 20:42 ` [PATCH net-next 39/54] net: ethernet: nxp: " Uwe Kleine-König
                   ` (16 subsequent siblings)
  54 siblings, 0 replies; 70+ messages in thread
From: Uwe Kleine-König @ 2023-09-18 20:42 UTC (permalink / raw)
  To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: Simon Horman, Krzysztof Kozlowski, Maciej Fijalkowski,
	Andrew Lunn, Rob Herring, Yuri Karpov, netdev, kernel

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.
To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new() which already returns void. Eventually after all drivers
are converted, .remove_new() is renamed to .remove().

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/net/ethernet/ni/nixge.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/ni/nixge.c b/drivers/net/ethernet/ni/nixge.c
index ba27bbc68f85..97f4798f4b42 100644
--- a/drivers/net/ethernet/ni/nixge.c
+++ b/drivers/net/ethernet/ni/nixge.c
@@ -1397,7 +1397,7 @@ static int nixge_probe(struct platform_device *pdev)
 	return err;
 }
 
-static int nixge_remove(struct platform_device *pdev)
+static void nixge_remove(struct platform_device *pdev)
 {
 	struct net_device *ndev = platform_get_drvdata(pdev);
 	struct nixge_priv *priv = netdev_priv(ndev);
@@ -1412,13 +1412,11 @@ static int nixge_remove(struct platform_device *pdev)
 		mdiobus_unregister(priv->mii_bus);
 
 	free_netdev(ndev);
-
-	return 0;
 }
 
 static struct platform_driver nixge_driver = {
 	.probe		= nixge_probe,
-	.remove		= nixge_remove,
+	.remove_new	= nixge_remove,
 	.driver		= {
 		.name		= "nixge",
 		.of_match_table	= nixge_dt_ids,
-- 
2.40.1


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

* [PATCH net-next 39/54] net: ethernet: nxp: Convert to platform remove callback returning void
  2023-09-18 20:41 [PATCH net-next 00/54] net: ethernet: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (37 preceding siblings ...)
  2023-09-18 20:42 ` [PATCH net-next 38/54] net: ethernet: ni: " Uwe Kleine-König
@ 2023-09-18 20:42 ` Uwe Kleine-König
  2023-09-18 20:42 ` [PATCH net-next 40/54] net: ethernet: qualcomm: " Uwe Kleine-König
                   ` (15 subsequent siblings)
  54 siblings, 0 replies; 70+ messages in thread
From: Uwe Kleine-König @ 2023-09-18 20:42 UTC (permalink / raw)
  To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: Vladimir Zapolskiy, linux-arm-kernel, netdev, kernel

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.
To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new() which already returns void. Eventually after all drivers
are converted, .remove_new() is renamed to .remove().

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/net/ethernet/nxp/lpc_eth.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/nxp/lpc_eth.c b/drivers/net/ethernet/nxp/lpc_eth.c
index 1a4a272f4c5c..dd3e58a1319c 100644
--- a/drivers/net/ethernet/nxp/lpc_eth.c
+++ b/drivers/net/ethernet/nxp/lpc_eth.c
@@ -1417,7 +1417,7 @@ static int lpc_eth_drv_probe(struct platform_device *pdev)
 	return ret;
 }
 
-static int lpc_eth_drv_remove(struct platform_device *pdev)
+static void lpc_eth_drv_remove(struct platform_device *pdev)
 {
 	struct net_device *ndev = platform_get_drvdata(pdev);
 	struct netdata_local *pldat = netdev_priv(ndev);
@@ -1436,8 +1436,6 @@ static int lpc_eth_drv_remove(struct platform_device *pdev)
 	clk_disable_unprepare(pldat->clk);
 	clk_put(pldat->clk);
 	free_netdev(ndev);
-
-	return 0;
 }
 
 #ifdef CONFIG_PM
@@ -1505,7 +1503,7 @@ MODULE_DEVICE_TABLE(of, lpc_eth_match);
 
 static struct platform_driver lpc_eth_driver = {
 	.probe		= lpc_eth_drv_probe,
-	.remove		= lpc_eth_drv_remove,
+	.remove_new	= lpc_eth_drv_remove,
 #ifdef CONFIG_PM
 	.suspend	= lpc_eth_drv_suspend,
 	.resume		= lpc_eth_drv_resume,
-- 
2.40.1


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

* [PATCH net-next 40/54] net: ethernet: qualcomm: Convert to platform remove callback returning void
  2023-09-18 20:41 [PATCH net-next 00/54] net: ethernet: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (38 preceding siblings ...)
  2023-09-18 20:42 ` [PATCH net-next 39/54] net: ethernet: nxp: " Uwe Kleine-König
@ 2023-09-18 20:42 ` Uwe Kleine-König
  2023-09-19  0:29   ` Timur Tabi
  2023-09-18 20:42 ` [PATCH net-next 41/54] net: ethernet: renesas: " Uwe Kleine-König
                   ` (14 subsequent siblings)
  54 siblings, 1 reply; 70+ messages in thread
From: Uwe Kleine-König @ 2023-09-18 20:42 UTC (permalink / raw)
  To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: Timur Tabi, netdev, kernel

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.
To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new() which already returns void. Eventually after all drivers
are converted, .remove_new() is renamed to .remove().

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/net/ethernet/qualcomm/emac/emac.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/qualcomm/emac/emac.c b/drivers/net/ethernet/qualcomm/emac/emac.c
index 19bb16daf4e7..3270df72541b 100644
--- a/drivers/net/ethernet/qualcomm/emac/emac.c
+++ b/drivers/net/ethernet/qualcomm/emac/emac.c
@@ -718,7 +718,7 @@ static int emac_probe(struct platform_device *pdev)
 	return ret;
 }
 
-static int emac_remove(struct platform_device *pdev)
+static void emac_remove(struct platform_device *pdev)
 {
 	struct net_device *netdev = dev_get_drvdata(&pdev->dev);
 	struct emac_adapter *adpt = netdev_priv(netdev);
@@ -742,8 +742,6 @@ static int emac_remove(struct platform_device *pdev)
 	iounmap(adpt->phy.base);
 
 	free_netdev(netdev);
-
-	return 0;
 }
 
 static void emac_shutdown(struct platform_device *pdev)
@@ -762,7 +760,7 @@ static void emac_shutdown(struct platform_device *pdev)
 
 static struct platform_driver emac_platform_driver = {
 	.probe	= emac_probe,
-	.remove	= emac_remove,
+	.remove_new = emac_remove,
 	.driver = {
 		.name		= "qcom-emac",
 		.of_match_table = emac_dt_match,
-- 
2.40.1


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

* [PATCH net-next 41/54] net: ethernet: renesas: Convert to platform remove callback returning void
  2023-09-18 20:41 [PATCH net-next 00/54] net: ethernet: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (39 preceding siblings ...)
  2023-09-18 20:42 ` [PATCH net-next 40/54] net: ethernet: qualcomm: " Uwe Kleine-König
@ 2023-09-18 20:42 ` Uwe Kleine-König
  2023-09-19  6:58   ` Geert Uytterhoeven
                     ` (2 more replies)
  2023-09-18 20:42 ` [PATCH net-next 42/54] net: ethernet: samsung: " Uwe Kleine-König
                   ` (13 subsequent siblings)
  54 siblings, 3 replies; 70+ messages in thread
From: Uwe Kleine-König @ 2023-09-18 20:42 UTC (permalink / raw)
  To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: Sergey Shtylyov, Geert Uytterhoeven, Yoshihiro Shimoda,
	Simon Horman, Wolfram Sang, Biju Das, Alexander Duyck,
	Michael Walle, Rob Herring, Andrew Lunn, netdev,
	linux-renesas-soc, kernel

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.
To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new() which already returns void. Eventually after all drivers
are converted, .remove_new() is renamed to .remove().

Trivially convert these drivers from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/net/ethernet/renesas/ravb_main.c | 6 ++----
 drivers/net/ethernet/renesas/rswitch.c   | 6 ++----
 drivers/net/ethernet/renesas/sh_eth.c    | 6 ++----
 3 files changed, 6 insertions(+), 12 deletions(-)

diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
index 7df9f9f8e134..e62391180032 100644
--- a/drivers/net/ethernet/renesas/ravb_main.c
+++ b/drivers/net/ethernet/renesas/ravb_main.c
@@ -2878,7 +2878,7 @@ static int ravb_probe(struct platform_device *pdev)
 	return error;
 }
 
-static int ravb_remove(struct platform_device *pdev)
+static void ravb_remove(struct platform_device *pdev)
 {
 	struct net_device *ndev = platform_get_drvdata(pdev);
 	struct ravb_private *priv = netdev_priv(ndev);
@@ -2905,8 +2905,6 @@ static int ravb_remove(struct platform_device *pdev)
 	reset_control_assert(priv->rstc);
 	free_netdev(ndev);
 	platform_set_drvdata(pdev, NULL);
-
-	return 0;
 }
 
 static int ravb_wol_setup(struct net_device *ndev)
@@ -3044,7 +3042,7 @@ static const struct dev_pm_ops ravb_dev_pm_ops = {
 
 static struct platform_driver ravb_driver = {
 	.probe		= ravb_probe,
-	.remove		= ravb_remove,
+	.remove_new	= ravb_remove,
 	.driver = {
 		.name	= "ravb",
 		.pm	= &ravb_dev_pm_ops,
diff --git a/drivers/net/ethernet/renesas/rswitch.c b/drivers/net/ethernet/renesas/rswitch.c
index ea9186178091..3c165b15709f 100644
--- a/drivers/net/ethernet/renesas/rswitch.c
+++ b/drivers/net/ethernet/renesas/rswitch.c
@@ -1968,7 +1968,7 @@ static void rswitch_deinit(struct rswitch_private *priv)
 	rswitch_clock_disable(priv);
 }
 
-static int renesas_eth_sw_remove(struct platform_device *pdev)
+static void renesas_eth_sw_remove(struct platform_device *pdev)
 {
 	struct rswitch_private *priv = platform_get_drvdata(pdev);
 
@@ -1978,13 +1978,11 @@ static int renesas_eth_sw_remove(struct platform_device *pdev)
 	pm_runtime_disable(&pdev->dev);
 
 	platform_set_drvdata(pdev, NULL);
-
-	return 0;
 }
 
 static struct platform_driver renesas_eth_sw_driver_platform = {
 	.probe = renesas_eth_sw_probe,
-	.remove = renesas_eth_sw_remove,
+	.remove_new = renesas_eth_sw_remove,
 	.driver = {
 		.name = "renesas_eth_sw",
 		.of_match_table = renesas_eth_sw_of_table,
diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
index 274ea16c0a1f..475e1e8c1d35 100644
--- a/drivers/net/ethernet/renesas/sh_eth.c
+++ b/drivers/net/ethernet/renesas/sh_eth.c
@@ -3431,7 +3431,7 @@ static int sh_eth_drv_probe(struct platform_device *pdev)
 	return ret;
 }
 
-static int sh_eth_drv_remove(struct platform_device *pdev)
+static void sh_eth_drv_remove(struct platform_device *pdev)
 {
 	struct net_device *ndev = platform_get_drvdata(pdev);
 	struct sh_eth_private *mdp = netdev_priv(ndev);
@@ -3441,8 +3441,6 @@ static int sh_eth_drv_remove(struct platform_device *pdev)
 	sh_mdio_release(mdp);
 	pm_runtime_disable(&pdev->dev);
 	free_netdev(ndev);
-
-	return 0;
 }
 
 #ifdef CONFIG_PM
@@ -3562,7 +3560,7 @@ MODULE_DEVICE_TABLE(platform, sh_eth_id_table);
 
 static struct platform_driver sh_eth_driver = {
 	.probe = sh_eth_drv_probe,
-	.remove = sh_eth_drv_remove,
+	.remove_new = sh_eth_drv_remove,
 	.id_table = sh_eth_id_table,
 	.driver = {
 		   .name = CARDNAME,
-- 
2.40.1


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

* [PATCH net-next 42/54] net: ethernet: samsung: Convert to platform remove callback returning void
  2023-09-18 20:41 [PATCH net-next 00/54] net: ethernet: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (40 preceding siblings ...)
  2023-09-18 20:42 ` [PATCH net-next 41/54] net: ethernet: renesas: " Uwe Kleine-König
@ 2023-09-18 20:42 ` Uwe Kleine-König
  2023-09-18 20:42 ` [PATCH net-next 43/54] net: ethernet: seeq: " Uwe Kleine-König
                   ` (12 subsequent siblings)
  54 siblings, 0 replies; 70+ messages in thread
From: Uwe Kleine-König @ 2023-09-18 20:42 UTC (permalink / raw)
  To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: Byungho An, netdev, kernel

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.
To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new() which already returns void. Eventually after all drivers
are converted, .remove_new() is renamed to .remove().

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/net/ethernet/samsung/sxgbe/sxgbe_platform.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/samsung/sxgbe/sxgbe_platform.c b/drivers/net/ethernet/samsung/sxgbe/sxgbe_platform.c
index fb59ff94509a..e6e130dbe1de 100644
--- a/drivers/net/ethernet/samsung/sxgbe/sxgbe_platform.c
+++ b/drivers/net/ethernet/samsung/sxgbe/sxgbe_platform.c
@@ -169,13 +169,11 @@ static int sxgbe_platform_probe(struct platform_device *pdev)
  * Description: this function calls the main to free the net resources
  * and calls the platforms hook and release the resources (e.g. mem).
  */
-static int sxgbe_platform_remove(struct platform_device *pdev)
+static void sxgbe_platform_remove(struct platform_device *pdev)
 {
 	struct net_device *ndev = platform_get_drvdata(pdev);
 
 	sxgbe_drv_remove(ndev);
-
-	return 0;
 }
 
 #ifdef CONFIG_PM
@@ -226,7 +224,7 @@ MODULE_DEVICE_TABLE(of, sxgbe_dt_ids);
 
 static struct platform_driver sxgbe_platform_driver = {
 	.probe	= sxgbe_platform_probe,
-	.remove	= sxgbe_platform_remove,
+	.remove_new = sxgbe_platform_remove,
 	.driver	= {
 		.name		= SXGBE_RESOURCE_NAME,
 		.pm		= &sxgbe_platform_pm_ops,
-- 
2.40.1


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

* [PATCH net-next 43/54] net: ethernet: seeq: Convert to platform remove callback returning void
  2023-09-18 20:41 [PATCH net-next 00/54] net: ethernet: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (41 preceding siblings ...)
  2023-09-18 20:42 ` [PATCH net-next 42/54] net: ethernet: samsung: " Uwe Kleine-König
@ 2023-09-18 20:42 ` Uwe Kleine-König
  2023-09-18 20:42 ` [PATCH net-next 44/54] net: ethernet: sgi: " Uwe Kleine-König
                   ` (11 subsequent siblings)
  54 siblings, 0 replies; 70+ messages in thread
From: Uwe Kleine-König @ 2023-09-18 20:42 UTC (permalink / raw)
  To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni; +Cc: netdev, kernel

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.
To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new() which already returns void. Eventually after all drivers
are converted, .remove_new() is renamed to .remove().

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/net/ethernet/seeq/sgiseeq.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/seeq/sgiseeq.c b/drivers/net/ethernet/seeq/sgiseeq.c
index 96065dfc747b..76356dadf233 100644
--- a/drivers/net/ethernet/seeq/sgiseeq.c
+++ b/drivers/net/ethernet/seeq/sgiseeq.c
@@ -819,7 +819,7 @@ static int sgiseeq_probe(struct platform_device *pdev)
 	return err;
 }
 
-static int sgiseeq_remove(struct platform_device *pdev)
+static void sgiseeq_remove(struct platform_device *pdev)
 {
 	struct net_device *dev = platform_get_drvdata(pdev);
 	struct sgiseeq_private *sp = netdev_priv(dev);
@@ -828,13 +828,11 @@ static int sgiseeq_remove(struct platform_device *pdev)
 	dma_free_noncoherent(&pdev->dev, sizeof(*sp->srings), sp->srings,
 		       sp->srings_dma, DMA_BIDIRECTIONAL);
 	free_netdev(dev);
-
-	return 0;
 }
 
 static struct platform_driver sgiseeq_driver = {
 	.probe	= sgiseeq_probe,
-	.remove	= sgiseeq_remove,
+	.remove_new = sgiseeq_remove,
 	.driver = {
 		.name	= "sgiseeq",
 	}
-- 
2.40.1


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

* [PATCH net-next 44/54] net: ethernet: sgi: Convert to platform remove callback returning void
  2023-09-18 20:41 [PATCH net-next 00/54] net: ethernet: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (42 preceding siblings ...)
  2023-09-18 20:42 ` [PATCH net-next 43/54] net: ethernet: seeq: " Uwe Kleine-König
@ 2023-09-18 20:42 ` Uwe Kleine-König
  2023-09-18 20:42 ` [PATCH net-next 45/54] net: ethernet: smsc: " Uwe Kleine-König
                   ` (10 subsequent siblings)
  54 siblings, 0 replies; 70+ messages in thread
From: Uwe Kleine-König @ 2023-09-18 20:42 UTC (permalink / raw)
  To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: Ralf Baechle, linux-mips, netdev, kernel

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.
To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new() which already returns void. Eventually after all drivers
are converted, .remove_new() is renamed to .remove().

Trivially convert these drivers from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/net/ethernet/sgi/ioc3-eth.c | 6 ++----
 drivers/net/ethernet/sgi/meth.c     | 6 ++----
 2 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/drivers/net/ethernet/sgi/ioc3-eth.c b/drivers/net/ethernet/sgi/ioc3-eth.c
index 8fc3f5272fa7..98d0b561a057 100644
--- a/drivers/net/ethernet/sgi/ioc3-eth.c
+++ b/drivers/net/ethernet/sgi/ioc3-eth.c
@@ -962,7 +962,7 @@ static int ioc3eth_probe(struct platform_device *pdev)
 	return err;
 }
 
-static int ioc3eth_remove(struct platform_device *pdev)
+static void ioc3eth_remove(struct platform_device *pdev)
 {
 	struct net_device *dev = platform_get_drvdata(pdev);
 	struct ioc3_private *ip = netdev_priv(dev);
@@ -973,8 +973,6 @@ static int ioc3eth_remove(struct platform_device *pdev)
 	unregister_netdev(dev);
 	del_timer_sync(&ip->ioc3_timer);
 	free_netdev(dev);
-
-	return 0;
 }
 
 
@@ -1275,7 +1273,7 @@ static void ioc3_set_multicast_list(struct net_device *dev)
 
 static struct platform_driver ioc3eth_driver = {
 	.probe  = ioc3eth_probe,
-	.remove = ioc3eth_remove,
+	.remove_new = ioc3eth_remove,
 	.driver = {
 		.name = "ioc3-eth",
 	}
diff --git a/drivers/net/ethernet/sgi/meth.c b/drivers/net/ethernet/sgi/meth.c
index 6d850ea2b94c..18b6f93d875e 100644
--- a/drivers/net/ethernet/sgi/meth.c
+++ b/drivers/net/ethernet/sgi/meth.c
@@ -854,19 +854,17 @@ static int meth_probe(struct platform_device *pdev)
 	return 0;
 }
 
-static int meth_remove(struct platform_device *pdev)
+static void meth_remove(struct platform_device *pdev)
 {
 	struct net_device *dev = platform_get_drvdata(pdev);
 
 	unregister_netdev(dev);
 	free_netdev(dev);
-
-	return 0;
 }
 
 static struct platform_driver meth_driver = {
 	.probe	= meth_probe,
-	.remove	= meth_remove,
+	.remove_new = meth_remove,
 	.driver = {
 		.name	= "meth",
 	}
-- 
2.40.1


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

* [PATCH net-next 45/54] net: ethernet: smsc: Convert to platform remove callback returning void
  2023-09-18 20:41 [PATCH net-next 00/54] net: ethernet: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (43 preceding siblings ...)
  2023-09-18 20:42 ` [PATCH net-next 44/54] net: ethernet: sgi: " Uwe Kleine-König
@ 2023-09-18 20:42 ` Uwe Kleine-König
  2023-09-18 20:42 ` [PATCH net-next 46/54] net: ethernet: socionext: " Uwe Kleine-König
                   ` (9 subsequent siblings)
  54 siblings, 0 replies; 70+ messages in thread
From: Uwe Kleine-König @ 2023-09-18 20:42 UTC (permalink / raw)
  To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: Nicolas Pitre, Steve Glendinning, Andy Shevchenko, netdev, kernel

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.
To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new() which already returns void. Eventually after all drivers
are converted, .remove_new() is renamed to .remove().

Trivially convert these drivers from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/net/ethernet/smsc/smc91x.c   | 6 ++----
 drivers/net/ethernet/smsc/smsc911x.c | 6 ++----
 2 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/drivers/net/ethernet/smsc/smc91x.c b/drivers/net/ethernet/smsc/smc91x.c
index 032eccf8eb42..758347616535 100644
--- a/drivers/net/ethernet/smsc/smc91x.c
+++ b/drivers/net/ethernet/smsc/smc91x.c
@@ -2411,7 +2411,7 @@ static int smc_drv_probe(struct platform_device *pdev)
 	return ret;
 }
 
-static int smc_drv_remove(struct platform_device *pdev)
+static void smc_drv_remove(struct platform_device *pdev)
 {
 	struct net_device *ndev = platform_get_drvdata(pdev);
 	struct smc_local *lp = netdev_priv(ndev);
@@ -2436,8 +2436,6 @@ static int smc_drv_remove(struct platform_device *pdev)
 	release_mem_region(res->start, SMC_IO_EXTENT);
 
 	free_netdev(ndev);
-
-	return 0;
 }
 
 static int smc_drv_suspend(struct device *dev)
@@ -2480,7 +2478,7 @@ static const struct dev_pm_ops smc_drv_pm_ops = {
 
 static struct platform_driver smc_driver = {
 	.probe		= smc_drv_probe,
-	.remove		= smc_drv_remove,
+	.remove_new	= smc_drv_remove,
 	.driver		= {
 		.name	= CARDNAME,
 		.pm	= &smc_drv_pm_ops,
diff --git a/drivers/net/ethernet/smsc/smsc911x.c b/drivers/net/ethernet/smsc/smsc911x.c
index cb590db625e8..31cb7d0166f0 100644
--- a/drivers/net/ethernet/smsc/smsc911x.c
+++ b/drivers/net/ethernet/smsc/smsc911x.c
@@ -2314,7 +2314,7 @@ static int smsc911x_init(struct net_device *dev)
 	return 0;
 }
 
-static int smsc911x_drv_remove(struct platform_device *pdev)
+static void smsc911x_drv_remove(struct platform_device *pdev)
 {
 	struct net_device *dev;
 	struct smsc911x_data *pdata;
@@ -2348,8 +2348,6 @@ static int smsc911x_drv_remove(struct platform_device *pdev)
 	free_netdev(dev);
 
 	pm_runtime_disable(&pdev->dev);
-
-	return 0;
 }
 
 /* standard register acces */
@@ -2668,7 +2666,7 @@ MODULE_DEVICE_TABLE(acpi, smsc911x_acpi_match);
 
 static struct platform_driver smsc911x_driver = {
 	.probe = smsc911x_drv_probe,
-	.remove = smsc911x_drv_remove,
+	.remove_new = smsc911x_drv_remove,
 	.driver = {
 		.name	= SMSC_CHIPNAME,
 		.pm	= SMSC911X_PM_OPS,
-- 
2.40.1


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

* [PATCH net-next 46/54] net: ethernet: socionext: Convert to platform remove callback returning void
  2023-09-18 20:41 [PATCH net-next 00/54] net: ethernet: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (44 preceding siblings ...)
  2023-09-18 20:42 ` [PATCH net-next 45/54] net: ethernet: smsc: " Uwe Kleine-König
@ 2023-09-18 20:42 ` Uwe Kleine-König
  2023-09-18 20:42 ` [PATCH net-next 47/54] net: ethernet: sun: " Uwe Kleine-König
                   ` (8 subsequent siblings)
  54 siblings, 0 replies; 70+ messages in thread
From: Uwe Kleine-König @ 2023-09-18 20:42 UTC (permalink / raw)
  To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: Jassi Brar, Ilias Apalodimas, Kunihiko Hayashi, netdev, kernel

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.
To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new() which already returns void. Eventually after all drivers
are converted, .remove_new() is renamed to .remove().

Trivially convert these drivers from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/net/ethernet/socionext/netsec.c  | 6 ++----
 drivers/net/ethernet/socionext/sni_ave.c | 6 ++----
 2 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/drivers/net/ethernet/socionext/netsec.c b/drivers/net/ethernet/socionext/netsec.c
index f358ea003193..d9cfafb96085 100644
--- a/drivers/net/ethernet/socionext/netsec.c
+++ b/drivers/net/ethernet/socionext/netsec.c
@@ -2150,7 +2150,7 @@ static int netsec_probe(struct platform_device *pdev)
 	return ret;
 }
 
-static int netsec_remove(struct platform_device *pdev)
+static void netsec_remove(struct platform_device *pdev)
 {
 	struct netsec_priv *priv = platform_get_drvdata(pdev);
 
@@ -2162,8 +2162,6 @@ static int netsec_remove(struct platform_device *pdev)
 
 	pm_runtime_disable(&pdev->dev);
 	free_netdev(priv->ndev);
-
-	return 0;
 }
 
 #ifdef CONFIG_PM
@@ -2211,7 +2209,7 @@ MODULE_DEVICE_TABLE(acpi, netsec_acpi_ids);
 
 static struct platform_driver netsec_driver = {
 	.probe	= netsec_probe,
-	.remove	= netsec_remove,
+	.remove_new = netsec_remove,
 	.driver = {
 		.name = "netsec",
 		.pm = &netsec_pm_ops,
diff --git a/drivers/net/ethernet/socionext/sni_ave.c b/drivers/net/ethernet/socionext/sni_ave.c
index 4838d2383a43..eed24e67c5a6 100644
--- a/drivers/net/ethernet/socionext/sni_ave.c
+++ b/drivers/net/ethernet/socionext/sni_ave.c
@@ -1719,7 +1719,7 @@ static int ave_probe(struct platform_device *pdev)
 	return ret;
 }
 
-static int ave_remove(struct platform_device *pdev)
+static void ave_remove(struct platform_device *pdev)
 {
 	struct net_device *ndev = platform_get_drvdata(pdev);
 	struct ave_private *priv = netdev_priv(ndev);
@@ -1727,8 +1727,6 @@ static int ave_remove(struct platform_device *pdev)
 	unregister_netdev(ndev);
 	netif_napi_del(&priv->napi_rx);
 	netif_napi_del(&priv->napi_tx);
-
-	return 0;
 }
 
 #ifdef CONFIG_PM_SLEEP
@@ -1976,7 +1974,7 @@ MODULE_DEVICE_TABLE(of, of_ave_match);
 
 static struct platform_driver ave_driver = {
 	.probe  = ave_probe,
-	.remove = ave_remove,
+	.remove_new = ave_remove,
 	.driver	= {
 		.name = "ave",
 		.pm   = AVE_PM_OPS,
-- 
2.40.1


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

* [PATCH net-next 47/54] net: ethernet: sun: Convert to platform remove callback returning void
  2023-09-18 20:41 [PATCH net-next 00/54] net: ethernet: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (45 preceding siblings ...)
  2023-09-18 20:42 ` [PATCH net-next 46/54] net: ethernet: socionext: " Uwe Kleine-König
@ 2023-09-18 20:42 ` Uwe Kleine-König
  2023-09-18 20:42 ` [PATCH net-next 48/54] net: ethernet: sunplus: " Uwe Kleine-König
                   ` (7 subsequent siblings)
  54 siblings, 0 replies; 70+ messages in thread
From: Uwe Kleine-König @ 2023-09-18 20:42 UTC (permalink / raw)
  To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: Simon Horman, Rob Herring, Marc Kleine-Budde, Harshit Mogalapalli,
	Alex Elder, Bhupesh Sharma, Wei Fang, netdev, kernel

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.
To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new() which already returns void. Eventually after all drivers
are converted, .remove_new() is renamed to .remove().

Trivially convert these drivers from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/net/ethernet/sun/niu.c     | 5 ++---
 drivers/net/ethernet/sun/sunbmac.c | 6 ++----
 drivers/net/ethernet/sun/sunqe.c   | 6 ++----
 3 files changed, 6 insertions(+), 11 deletions(-)

diff --git a/drivers/net/ethernet/sun/niu.c b/drivers/net/ethernet/sun/niu.c
index 011d74087f86..21431f43e4c2 100644
--- a/drivers/net/ethernet/sun/niu.c
+++ b/drivers/net/ethernet/sun/niu.c
@@ -10132,7 +10132,7 @@ static int niu_of_probe(struct platform_device *op)
 	return err;
 }
 
-static int niu_of_remove(struct platform_device *op)
+static void niu_of_remove(struct platform_device *op)
 {
 	struct net_device *dev = platform_get_drvdata(op);
 
@@ -10165,7 +10165,6 @@ static int niu_of_remove(struct platform_device *op)
 
 		free_netdev(dev);
 	}
-	return 0;
 }
 
 static const struct of_device_id niu_match[] = {
@@ -10183,7 +10182,7 @@ static struct platform_driver niu_of_driver = {
 		.of_match_table = niu_match,
 	},
 	.probe		= niu_of_probe,
-	.remove		= niu_of_remove,
+	.remove_new	= niu_of_remove,
 };
 
 #endif /* CONFIG_SPARC64 */
diff --git a/drivers/net/ethernet/sun/sunbmac.c b/drivers/net/ethernet/sun/sunbmac.c
index cc34d92d2e3d..16c86b13c185 100644
--- a/drivers/net/ethernet/sun/sunbmac.c
+++ b/drivers/net/ethernet/sun/sunbmac.c
@@ -1234,7 +1234,7 @@ static int bigmac_sbus_probe(struct platform_device *op)
 	return bigmac_ether_init(op, qec_op);
 }
 
-static int bigmac_sbus_remove(struct platform_device *op)
+static void bigmac_sbus_remove(struct platform_device *op)
 {
 	struct bigmac *bp = platform_get_drvdata(op);
 	struct device *parent = op->dev.parent;
@@ -1255,8 +1255,6 @@ static int bigmac_sbus_remove(struct platform_device *op)
 			  bp->bblock_dvma);
 
 	free_netdev(net_dev);
-
-	return 0;
 }
 
 static const struct of_device_id bigmac_sbus_match[] = {
@@ -1274,7 +1272,7 @@ static struct platform_driver bigmac_sbus_driver = {
 		.of_match_table = bigmac_sbus_match,
 	},
 	.probe		= bigmac_sbus_probe,
-	.remove		= bigmac_sbus_remove,
+	.remove_new	= bigmac_sbus_remove,
 };
 
 module_platform_driver(bigmac_sbus_driver);
diff --git a/drivers/net/ethernet/sun/sunqe.c b/drivers/net/ethernet/sun/sunqe.c
index b37360f44972..aedd13c94225 100644
--- a/drivers/net/ethernet/sun/sunqe.c
+++ b/drivers/net/ethernet/sun/sunqe.c
@@ -933,7 +933,7 @@ static int qec_sbus_probe(struct platform_device *op)
 	return qec_ether_init(op);
 }
 
-static int qec_sbus_remove(struct platform_device *op)
+static void qec_sbus_remove(struct platform_device *op)
 {
 	struct sunqe *qp = platform_get_drvdata(op);
 	struct net_device *net_dev = qp->dev;
@@ -948,8 +948,6 @@ static int qec_sbus_remove(struct platform_device *op)
 			  qp->buffers, qp->buffers_dvma);
 
 	free_netdev(net_dev);
-
-	return 0;
 }
 
 static const struct of_device_id qec_sbus_match[] = {
@@ -967,7 +965,7 @@ static struct platform_driver qec_sbus_driver = {
 		.of_match_table = qec_sbus_match,
 	},
 	.probe		= qec_sbus_probe,
-	.remove		= qec_sbus_remove,
+	.remove_new	= qec_sbus_remove,
 };
 
 static int __init qec_init(void)
-- 
2.40.1


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

* [PATCH net-next 48/54] net: ethernet: sunplus: Convert to platform remove callback returning void
  2023-09-18 20:41 [PATCH net-next 00/54] net: ethernet: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (46 preceding siblings ...)
  2023-09-18 20:42 ` [PATCH net-next 47/54] net: ethernet: sun: " Uwe Kleine-König
@ 2023-09-18 20:42 ` Uwe Kleine-König
  2023-09-18 20:42 ` [PATCH net-next 49/54] net: ethernet: ti: " Uwe Kleine-König
                   ` (6 subsequent siblings)
  54 siblings, 0 replies; 70+ messages in thread
From: Uwe Kleine-König @ 2023-09-18 20:42 UTC (permalink / raw)
  To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: Wells Lu, netdev, kernel

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.
To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new() which already returns void. Eventually after all drivers
are converted, .remove_new() is renamed to .remove().

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/net/ethernet/sunplus/spl2sw_driver.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/sunplus/spl2sw_driver.c b/drivers/net/ethernet/sunplus/spl2sw_driver.c
index c499a14314f1..391a1bc7f446 100644
--- a/drivers/net/ethernet/sunplus/spl2sw_driver.c
+++ b/drivers/net/ethernet/sunplus/spl2sw_driver.c
@@ -511,7 +511,7 @@ static int spl2sw_probe(struct platform_device *pdev)
 	return ret;
 }
 
-static int spl2sw_remove(struct platform_device *pdev)
+static void spl2sw_remove(struct platform_device *pdev)
 {
 	struct spl2sw_common *comm;
 	int i;
@@ -538,8 +538,6 @@ static int spl2sw_remove(struct platform_device *pdev)
 	spl2sw_mdio_remove(comm);
 
 	clk_disable_unprepare(comm->clk);
-
-	return 0;
 }
 
 static const struct of_device_id spl2sw_of_match[] = {
@@ -551,7 +549,7 @@ MODULE_DEVICE_TABLE(of, spl2sw_of_match);
 
 static struct platform_driver spl2sw_driver = {
 	.probe = spl2sw_probe,
-	.remove = spl2sw_remove,
+	.remove_new = spl2sw_remove,
 	.driver = {
 		.name = "sp7021_emac",
 		.of_match_table = spl2sw_of_match,
-- 
2.40.1


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

* [PATCH net-next 49/54] net: ethernet: ti: Convert to platform remove callback returning void
  2023-09-18 20:41 [PATCH net-next 00/54] net: ethernet: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (47 preceding siblings ...)
  2023-09-18 20:42 ` [PATCH net-next 48/54] net: ethernet: sunplus: " Uwe Kleine-König
@ 2023-09-18 20:42 ` Uwe Kleine-König
  2023-09-18 20:54   ` Florian Fainelli
  2023-09-18 20:42 ` [PATCH net-next 50/54] net: ethernet: tundra: " Uwe Kleine-König
                   ` (5 subsequent siblings)
  54 siblings, 1 reply; 70+ messages in thread
From: Uwe Kleine-König @ 2023-09-18 20:42 UTC (permalink / raw)
  To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: Florian Fainelli, Grygorii Strashko, Marc Kleine-Budde,
	Nathan Chancellor, Nathan Huckleberry, Geert Uytterhoeven,
	Bhupesh Sharma, Wei Fang, Andrew Lunn, Rob Herring,
	Thomas Gleixner, Sebastian Andrzej Siewior, Arnd Bergmann, netdev,
	kernel, linux-omap

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.
To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new() which already returns void. Eventually after all drivers
are converted, .remove_new() is renamed to .remove().

Trivially convert these drivers from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/net/ethernet/ti/cpmac.c        | 6 ++----
 drivers/net/ethernet/ti/davinci_emac.c | 6 ++----
 drivers/net/ethernet/ti/davinci_mdio.c | 6 ++----
 drivers/net/ethernet/ti/netcp_core.c   | 5 ++---
 4 files changed, 8 insertions(+), 15 deletions(-)

diff --git a/drivers/net/ethernet/ti/cpmac.c b/drivers/net/ethernet/ti/cpmac.c
index 80eeeb463c4f..bc9b5d18427d 100644
--- a/drivers/net/ethernet/ti/cpmac.c
+++ b/drivers/net/ethernet/ti/cpmac.c
@@ -1151,14 +1151,12 @@ static int cpmac_probe(struct platform_device *pdev)
 	return rc;
 }
 
-static int cpmac_remove(struct platform_device *pdev)
+static void cpmac_remove(struct platform_device *pdev)
 {
 	struct net_device *dev = platform_get_drvdata(pdev);
 
 	unregister_netdev(dev);
 	free_netdev(dev);
-
-	return 0;
 }
 
 static struct platform_driver cpmac_driver = {
@@ -1166,7 +1164,7 @@ static struct platform_driver cpmac_driver = {
 		.name 	= "cpmac",
 	},
 	.probe 	= cpmac_probe,
-	.remove = cpmac_remove,
+	.remove_new = cpmac_remove,
 };
 
 int __init cpmac_init(void)
diff --git a/drivers/net/ethernet/ti/davinci_emac.c b/drivers/net/ethernet/ti/davinci_emac.c
index 2eb9d5a32588..5d756df133eb 100644
--- a/drivers/net/ethernet/ti/davinci_emac.c
+++ b/drivers/net/ethernet/ti/davinci_emac.c
@@ -2002,7 +2002,7 @@ static int davinci_emac_probe(struct platform_device *pdev)
  * Called when removing the device driver. We disable clock usage and release
  * the resources taken up by the driver and unregister network device
  */
-static int davinci_emac_remove(struct platform_device *pdev)
+static void davinci_emac_remove(struct platform_device *pdev)
 {
 	struct net_device *ndev = platform_get_drvdata(pdev);
 	struct emac_priv *priv = netdev_priv(ndev);
@@ -2022,8 +2022,6 @@ static int davinci_emac_remove(struct platform_device *pdev)
 	if (of_phy_is_fixed_link(np))
 		of_phy_deregister_fixed_link(np);
 	free_netdev(ndev);
-
-	return 0;
 }
 
 static int davinci_emac_suspend(struct device *dev)
@@ -2076,7 +2074,7 @@ static struct platform_driver davinci_emac_driver = {
 		.of_match_table = davinci_emac_of_match,
 	},
 	.probe = davinci_emac_probe,
-	.remove = davinci_emac_remove,
+	.remove_new = davinci_emac_remove,
 };
 
 /**
diff --git a/drivers/net/ethernet/ti/davinci_mdio.c b/drivers/net/ethernet/ti/davinci_mdio.c
index 89b6d23e9937..628c87dc1d28 100644
--- a/drivers/net/ethernet/ti/davinci_mdio.c
+++ b/drivers/net/ethernet/ti/davinci_mdio.c
@@ -673,7 +673,7 @@ static int davinci_mdio_probe(struct platform_device *pdev)
 	return ret;
 }
 
-static int davinci_mdio_remove(struct platform_device *pdev)
+static void davinci_mdio_remove(struct platform_device *pdev)
 {
 	struct davinci_mdio_data *data = platform_get_drvdata(pdev);
 
@@ -686,8 +686,6 @@ static int davinci_mdio_remove(struct platform_device *pdev)
 
 	pm_runtime_dont_use_autosuspend(&pdev->dev);
 	pm_runtime_disable(&pdev->dev);
-
-	return 0;
 }
 
 #ifdef CONFIG_PM
@@ -766,7 +764,7 @@ static struct platform_driver davinci_mdio_driver = {
 		.of_match_table = of_match_ptr(davinci_mdio_of_mtable),
 	},
 	.probe = davinci_mdio_probe,
-	.remove = davinci_mdio_remove,
+	.remove_new = davinci_mdio_remove,
 };
 
 static int __init davinci_mdio_init(void)
diff --git a/drivers/net/ethernet/ti/netcp_core.c b/drivers/net/ethernet/ti/netcp_core.c
index d829113c16ee..11b90e1da0c6 100644
--- a/drivers/net/ethernet/ti/netcp_core.c
+++ b/drivers/net/ethernet/ti/netcp_core.c
@@ -2228,7 +2228,7 @@ static int netcp_probe(struct platform_device *pdev)
 	return ret;
 }
 
-static int netcp_remove(struct platform_device *pdev)
+static void netcp_remove(struct platform_device *pdev)
 {
 	struct netcp_device *netcp_device = platform_get_drvdata(pdev);
 	struct netcp_intf *netcp_intf, *netcp_tmp;
@@ -2256,7 +2256,6 @@ static int netcp_remove(struct platform_device *pdev)
 	pm_runtime_put_sync(&pdev->dev);
 	pm_runtime_disable(&pdev->dev);
 	platform_set_drvdata(pdev, NULL);
-	return 0;
 }
 
 static const struct of_device_id of_match[] = {
@@ -2271,7 +2270,7 @@ static struct platform_driver netcp_driver = {
 		.of_match_table	= of_match,
 	},
 	.probe = netcp_probe,
-	.remove = netcp_remove,
+	.remove_new = netcp_remove,
 };
 module_platform_driver(netcp_driver);
 
-- 
2.40.1


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

* [PATCH net-next 50/54] net: ethernet: tundra: Convert to platform remove callback returning void
  2023-09-18 20:41 [PATCH net-next 00/54] net: ethernet: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (48 preceding siblings ...)
  2023-09-18 20:42 ` [PATCH net-next 49/54] net: ethernet: ti: " Uwe Kleine-König
@ 2023-09-18 20:42 ` Uwe Kleine-König
  2023-09-18 20:42 ` [PATCH net-next 51/54] net: ethernet: via: " Uwe Kleine-König
                   ` (4 subsequent siblings)
  54 siblings, 0 replies; 70+ messages in thread
From: Uwe Kleine-König @ 2023-09-18 20:42 UTC (permalink / raw)
  To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: Marc Kleine-Budde, Zhengchao Shao, netdev, kernel

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.
To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new() which already returns void. Eventually after all drivers
are converted, .remove_new() is renamed to .remove().

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/net/ethernet/tundra/tsi108_eth.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/tundra/tsi108_eth.c b/drivers/net/ethernet/tundra/tsi108_eth.c
index d09d352e1c0a..554aff7c8f3b 100644
--- a/drivers/net/ethernet/tundra/tsi108_eth.c
+++ b/drivers/net/ethernet/tundra/tsi108_eth.c
@@ -1660,7 +1660,7 @@ static void tsi108_timed_checker(struct timer_list *t)
 	mod_timer(&data->timer, jiffies + CHECK_PHY_INTERVAL);
 }
 
-static int tsi108_ether_remove(struct platform_device *pdev)
+static void tsi108_ether_remove(struct platform_device *pdev)
 {
 	struct net_device *dev = platform_get_drvdata(pdev);
 	struct tsi108_prv_data *priv = netdev_priv(dev);
@@ -1670,15 +1670,13 @@ static int tsi108_ether_remove(struct platform_device *pdev)
 	iounmap(priv->regs);
 	iounmap(priv->phyregs);
 	free_netdev(dev);
-
-	return 0;
 }
 
 /* Structure for a device driver */
 
 static struct platform_driver tsi_eth_driver = {
 	.probe = tsi108_init_one,
-	.remove = tsi108_ether_remove,
+	.remove_new = tsi108_ether_remove,
 	.driver	= {
 		.name = "tsi-ethernet",
 	},
-- 
2.40.1


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

* [PATCH net-next 51/54] net: ethernet: via: Convert to platform remove callback returning void
  2023-09-18 20:41 [PATCH net-next 00/54] net: ethernet: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (49 preceding siblings ...)
  2023-09-18 20:42 ` [PATCH net-next 50/54] net: ethernet: tundra: " Uwe Kleine-König
@ 2023-09-18 20:42 ` Uwe Kleine-König
  2023-09-18 20:42 ` [PATCH net-next 52/54] net: ethernet: wiznet: " Uwe Kleine-König
                   ` (3 subsequent siblings)
  54 siblings, 0 replies; 70+ messages in thread
From: Uwe Kleine-König @ 2023-09-18 20:42 UTC (permalink / raw)
  To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: Kevin Brace, Francois Romieu, netdev, kernel

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.
To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new() which already returns void. Eventually after all drivers
are converted, .remove_new() is renamed to .remove().

Trivially convert these drivers from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/net/ethernet/via/via-rhine.c    | 6 ++----
 drivers/net/ethernet/via/via-velocity.c | 6 ++----
 2 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/drivers/net/ethernet/via/via-rhine.c b/drivers/net/ethernet/via/via-rhine.c
index 3e09e5036490..e80c02948801 100644
--- a/drivers/net/ethernet/via/via-rhine.c
+++ b/drivers/net/ethernet/via/via-rhine.c
@@ -2443,7 +2443,7 @@ static void rhine_remove_one_pci(struct pci_dev *pdev)
 	pci_disable_device(pdev);
 }
 
-static int rhine_remove_one_platform(struct platform_device *pdev)
+static void rhine_remove_one_platform(struct platform_device *pdev)
 {
 	struct net_device *dev = platform_get_drvdata(pdev);
 	struct rhine_private *rp = netdev_priv(dev);
@@ -2453,8 +2453,6 @@ static int rhine_remove_one_platform(struct platform_device *pdev)
 	iounmap(rp->base);
 
 	free_netdev(dev);
-
-	return 0;
 }
 
 static void rhine_shutdown_pci(struct pci_dev *pdev)
@@ -2572,7 +2570,7 @@ static struct pci_driver rhine_driver_pci = {
 
 static struct platform_driver rhine_driver_platform = {
 	.probe		= rhine_init_one_platform,
-	.remove		= rhine_remove_one_platform,
+	.remove_new	= rhine_remove_one_platform,
 	.driver = {
 		.name	= DRV_NAME,
 		.of_match_table	= rhine_of_tbl,
diff --git a/drivers/net/ethernet/via/via-velocity.c b/drivers/net/ethernet/via/via-velocity.c
index 731f689412e6..1c6b2a9bba08 100644
--- a/drivers/net/ethernet/via/via-velocity.c
+++ b/drivers/net/ethernet/via/via-velocity.c
@@ -2957,11 +2957,9 @@ static int velocity_platform_probe(struct platform_device *pdev)
 	return velocity_probe(&pdev->dev, irq, info, BUS_PLATFORM);
 }
 
-static int velocity_platform_remove(struct platform_device *pdev)
+static void velocity_platform_remove(struct platform_device *pdev)
 {
 	velocity_remove(&pdev->dev);
-
-	return 0;
 }
 
 #ifdef CONFIG_PM_SLEEP
@@ -3249,7 +3247,7 @@ static struct pci_driver velocity_pci_driver = {
 
 static struct platform_driver velocity_platform_driver = {
 	.probe		= velocity_platform_probe,
-	.remove		= velocity_platform_remove,
+	.remove_new	= velocity_platform_remove,
 	.driver = {
 		.name = "via-velocity",
 		.of_match_table = velocity_of_ids,
-- 
2.40.1


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

* [PATCH net-next 52/54] net: ethernet: wiznet: Convert to platform remove callback returning void
  2023-09-18 20:41 [PATCH net-next 00/54] net: ethernet: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (50 preceding siblings ...)
  2023-09-18 20:42 ` [PATCH net-next 51/54] net: ethernet: via: " Uwe Kleine-König
@ 2023-09-18 20:42 ` Uwe Kleine-König
  2023-09-18 20:42 ` [PATCH net-next 53/54] net: ethernet: xilinx: " Uwe Kleine-König
                   ` (2 subsequent siblings)
  54 siblings, 0 replies; 70+ messages in thread
From: Uwe Kleine-König @ 2023-09-18 20:42 UTC (permalink / raw)
  To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni; +Cc: netdev, kernel

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.
To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new() which already returns void. Eventually after all drivers
are converted, .remove_new() is renamed to .remove().

Trivially convert these drivers from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/net/ethernet/wiznet/w5100.c | 6 ++----
 drivers/net/ethernet/wiznet/w5300.c | 5 ++---
 2 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/net/ethernet/wiznet/w5100.c b/drivers/net/ethernet/wiznet/w5100.c
index 634946e87e5f..341ee2f249fd 100644
--- a/drivers/net/ethernet/wiznet/w5100.c
+++ b/drivers/net/ethernet/wiznet/w5100.c
@@ -1062,11 +1062,9 @@ static int w5100_mmio_probe(struct platform_device *pdev)
 			   mac_addr, irq, data ? data->link_gpio : -EINVAL);
 }
 
-static int w5100_mmio_remove(struct platform_device *pdev)
+static void w5100_mmio_remove(struct platform_device *pdev)
 {
 	w5100_remove(&pdev->dev);
-
-	return 0;
 }
 
 void *w5100_ops_priv(const struct net_device *ndev)
@@ -1273,6 +1271,6 @@ static struct platform_driver w5100_mmio_driver = {
 		.pm	= &w5100_pm_ops,
 	},
 	.probe		= w5100_mmio_probe,
-	.remove		= w5100_mmio_remove,
+	.remove_new	= w5100_mmio_remove,
 };
 module_platform_driver(w5100_mmio_driver);
diff --git a/drivers/net/ethernet/wiznet/w5300.c b/drivers/net/ethernet/wiznet/w5300.c
index b0958fe8111e..3318b50a5911 100644
--- a/drivers/net/ethernet/wiznet/w5300.c
+++ b/drivers/net/ethernet/wiznet/w5300.c
@@ -627,7 +627,7 @@ static int w5300_probe(struct platform_device *pdev)
 	return err;
 }
 
-static int w5300_remove(struct platform_device *pdev)
+static void w5300_remove(struct platform_device *pdev)
 {
 	struct net_device *ndev = platform_get_drvdata(pdev);
 	struct w5300_priv *priv = netdev_priv(ndev);
@@ -639,7 +639,6 @@ static int w5300_remove(struct platform_device *pdev)
 
 	unregister_netdev(ndev);
 	free_netdev(ndev);
-	return 0;
 }
 
 #ifdef CONFIG_PM_SLEEP
@@ -683,7 +682,7 @@ static struct platform_driver w5300_driver = {
 		.pm	= &w5300_pm_ops,
 	},
 	.probe		= w5300_probe,
-	.remove		= w5300_remove,
+	.remove_new	= w5300_remove,
 };
 
 module_platform_driver(w5300_driver);
-- 
2.40.1


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

* [PATCH net-next 53/54] net: ethernet: xilinx: Convert to platform remove callback returning void
  2023-09-18 20:41 [PATCH net-next 00/54] net: ethernet: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (51 preceding siblings ...)
  2023-09-18 20:42 ` [PATCH net-next 52/54] net: ethernet: wiznet: " Uwe Kleine-König
@ 2023-09-18 20:42 ` Uwe Kleine-König
  2023-09-19  4:45   ` Pandey, Radhey Shyam
  2023-09-18 20:42 ` [PATCH net-next 54/54] net: ethernet: xscale: " Uwe Kleine-König
  2023-09-20  8:10 ` [PATCH net-next 00/54] net: ethernet: " patchwork-bot+netdevbpf
  54 siblings, 1 reply; 70+ messages in thread
From: Uwe Kleine-König @ 2023-09-18 20:42 UTC (permalink / raw)
  To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: Michal Simek, Radhey Shyam Pandey, Harini Katakam, Haoyue Xu,
	huangjunxian, Rob Herring, Yang Yingliang, Dan Carpenter,
	Bhupesh Sharma, Simon Horman, Alex Elder, Wei Fang, netdev,
	linux-arm-kernel, kernel

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.
To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new() which already returns void. Eventually after all drivers
are converted, .remove_new() is renamed to .remove().

Trivially convert these drivers from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/net/ethernet/xilinx/ll_temac_main.c       | 5 ++---
 drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 6 ++----
 drivers/net/ethernet/xilinx/xilinx_emaclite.c     | 6 ++----
 3 files changed, 6 insertions(+), 11 deletions(-)

diff --git a/drivers/net/ethernet/xilinx/ll_temac_main.c b/drivers/net/ethernet/xilinx/ll_temac_main.c
index 1444b855e7aa..9df39cf8b097 100644
--- a/drivers/net/ethernet/xilinx/ll_temac_main.c
+++ b/drivers/net/ethernet/xilinx/ll_temac_main.c
@@ -1626,7 +1626,7 @@ static int temac_probe(struct platform_device *pdev)
 	return rc;
 }
 
-static int temac_remove(struct platform_device *pdev)
+static void temac_remove(struct platform_device *pdev)
 {
 	struct net_device *ndev = platform_get_drvdata(pdev);
 	struct temac_local *lp = netdev_priv(ndev);
@@ -1636,7 +1636,6 @@ static int temac_remove(struct platform_device *pdev)
 	if (lp->phy_node)
 		of_node_put(lp->phy_node);
 	temac_mdio_teardown(lp);
-	return 0;
 }
 
 static const struct of_device_id temac_of_match[] = {
@@ -1650,7 +1649,7 @@ MODULE_DEVICE_TABLE(of, temac_of_match);
 
 static struct platform_driver temac_driver = {
 	.probe = temac_probe,
-	.remove = temac_remove,
+	.remove_new = temac_remove,
 	.driver = {
 		.name = "xilinx_temac",
 		.of_match_table = temac_of_match,
diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
index b7ec4dafae90..82d0d44b2b02 100644
--- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
+++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
@@ -2183,7 +2183,7 @@ static int axienet_probe(struct platform_device *pdev)
 	return ret;
 }
 
-static int axienet_remove(struct platform_device *pdev)
+static void axienet_remove(struct platform_device *pdev)
 {
 	struct net_device *ndev = platform_get_drvdata(pdev);
 	struct axienet_local *lp = netdev_priv(ndev);
@@ -2202,8 +2202,6 @@ static int axienet_remove(struct platform_device *pdev)
 	clk_disable_unprepare(lp->axi_clk);
 
 	free_netdev(ndev);
-
-	return 0;
 }
 
 static void axienet_shutdown(struct platform_device *pdev)
@@ -2256,7 +2254,7 @@ static DEFINE_SIMPLE_DEV_PM_OPS(axienet_pm_ops,
 
 static struct platform_driver axienet_driver = {
 	.probe = axienet_probe,
-	.remove = axienet_remove,
+	.remove_new = axienet_remove,
 	.shutdown = axienet_shutdown,
 	.driver = {
 		 .name = "xilinx_axienet",
diff --git a/drivers/net/ethernet/xilinx/xilinx_emaclite.c b/drivers/net/ethernet/xilinx/xilinx_emaclite.c
index b358ecc67227..32a502e7318b 100644
--- a/drivers/net/ethernet/xilinx/xilinx_emaclite.c
+++ b/drivers/net/ethernet/xilinx/xilinx_emaclite.c
@@ -1183,7 +1183,7 @@ static int xemaclite_of_probe(struct platform_device *ofdev)
  *
  * Return:	0, always.
  */
-static int xemaclite_of_remove(struct platform_device *of_dev)
+static void xemaclite_of_remove(struct platform_device *of_dev)
 {
 	struct net_device *ndev = platform_get_drvdata(of_dev);
 
@@ -1202,8 +1202,6 @@ static int xemaclite_of_remove(struct platform_device *of_dev)
 	lp->phy_node = NULL;
 
 	free_netdev(ndev);
-
-	return 0;
 }
 
 #ifdef CONFIG_NET_POLL_CONTROLLER
@@ -1262,7 +1260,7 @@ static struct platform_driver xemaclite_of_driver = {
 		.of_match_table = xemaclite_of_match,
 	},
 	.probe		= xemaclite_of_probe,
-	.remove		= xemaclite_of_remove,
+	.remove_new	= xemaclite_of_remove,
 };
 
 module_platform_driver(xemaclite_of_driver);
-- 
2.40.1


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

* [PATCH net-next 54/54] net: ethernet: xscale: Convert to platform remove callback returning void
  2023-09-18 20:41 [PATCH net-next 00/54] net: ethernet: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (52 preceding siblings ...)
  2023-09-18 20:42 ` [PATCH net-next 53/54] net: ethernet: xilinx: " Uwe Kleine-König
@ 2023-09-18 20:42 ` Uwe Kleine-König
  2023-09-20  7:52   ` Krzysztof Hałasa
  2023-09-20  8:10 ` [PATCH net-next 00/54] net: ethernet: " patchwork-bot+netdevbpf
  54 siblings, 1 reply; 70+ messages in thread
From: Uwe Kleine-König @ 2023-09-18 20:42 UTC (permalink / raw)
  To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: Krzysztof Halasa, netdev, kernel

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.
To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new() which already returns void. Eventually after all drivers
are converted, .remove_new() is renamed to .remove().

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/net/ethernet/xscale/ixp4xx_eth.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/xscale/ixp4xx_eth.c b/drivers/net/ethernet/xscale/ixp4xx_eth.c
index 3b0c5f177447..b242aa61d8ab 100644
--- a/drivers/net/ethernet/xscale/ixp4xx_eth.c
+++ b/drivers/net/ethernet/xscale/ixp4xx_eth.c
@@ -1533,7 +1533,7 @@ static int ixp4xx_eth_probe(struct platform_device *pdev)
 	return err;
 }
 
-static int ixp4xx_eth_remove(struct platform_device *pdev)
+static void ixp4xx_eth_remove(struct platform_device *pdev)
 {
 	struct net_device *ndev = platform_get_drvdata(pdev);
 	struct phy_device *phydev = ndev->phydev;
@@ -1544,7 +1544,6 @@ static int ixp4xx_eth_remove(struct platform_device *pdev)
 	ixp4xx_mdio_remove();
 	npe_port_tab[NPE_ID(port->id)] = NULL;
 	npe_release(port->npe);
-	return 0;
 }
 
 static const struct of_device_id ixp4xx_eth_of_match[] = {
@@ -1560,7 +1559,7 @@ static struct platform_driver ixp4xx_eth_driver = {
 		.of_match_table = of_match_ptr(ixp4xx_eth_of_match),
 	},
 	.probe		= ixp4xx_eth_probe,
-	.remove		= ixp4xx_eth_remove,
+	.remove_new	= ixp4xx_eth_remove,
 };
 module_platform_driver(ixp4xx_eth_driver);
 
-- 
2.40.1


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

* Re: [PATCH net-next 28/54] net: ethernet: litex: Convert to platform remove callback returning void
  2023-09-18 20:42 ` [PATCH net-next 28/54] net: ethernet: litex: " Uwe Kleine-König
@ 2023-09-18 20:54   ` Gabriel L. Somlo
  0 siblings, 0 replies; 70+ messages in thread
From: Gabriel L. Somlo @ 2023-09-18 20:54 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Karol Gugala, Mateusz Holenko, Joel Stanley, netdev, kernel

On Mon, Sep 18, 2023 at 10:42:00PM +0200, Uwe Kleine-König wrote:
> The .remove() callback for a platform driver returns an int which makes
> many driver authors wrongly assume it's possible to do error handling by
> returning an error code. However the value returned is ignored (apart
> from emitting a warning) and this typically results in resource leaks.
> To improve here there is a quest to make the remove callback return
> void. In the first step of this quest all drivers are converted to
> .remove_new() which already returns void. Eventually after all drivers
> are converted, .remove_new() is renamed to .remove().
> 
> Trivially convert this driver from always returning zero in the remove
> callback to the void returning variant.

Acked-by: Gabriel Somlo <gsomlo@gmail.com>

Thanks,
--G
 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---
>  drivers/net/ethernet/litex/litex_liteeth.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/net/ethernet/litex/litex_liteeth.c b/drivers/net/ethernet/litex/litex_liteeth.c
> index ffa96059079c..5182fe737c37 100644
> --- a/drivers/net/ethernet/litex/litex_liteeth.c
> +++ b/drivers/net/ethernet/litex/litex_liteeth.c
> @@ -294,13 +294,11 @@ static int liteeth_probe(struct platform_device *pdev)
>  	return 0;
>  }
>  
> -static int liteeth_remove(struct platform_device *pdev)
> +static void liteeth_remove(struct platform_device *pdev)
>  {
>  	struct net_device *netdev = platform_get_drvdata(pdev);
>  
>  	unregister_netdev(netdev);
> -
> -	return 0;
>  }
>  
>  static const struct of_device_id liteeth_of_match[] = {
> @@ -311,7 +309,7 @@ MODULE_DEVICE_TABLE(of, liteeth_of_match);
>  
>  static struct platform_driver liteeth_driver = {
>  	.probe = liteeth_probe,
> -	.remove = liteeth_remove,
> +	.remove_new = liteeth_remove,
>  	.driver = {
>  		.name = DRV_NAME,
>  		.of_match_table = liteeth_of_match,
> -- 
> 2.40.1
> 

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

* Re: [PATCH net-next 49/54] net: ethernet: ti: Convert to platform remove callback returning void
  2023-09-18 20:42 ` [PATCH net-next 49/54] net: ethernet: ti: " Uwe Kleine-König
@ 2023-09-18 20:54   ` Florian Fainelli
  0 siblings, 0 replies; 70+ messages in thread
From: Florian Fainelli @ 2023-09-18 20:54 UTC (permalink / raw)
  To: Uwe Kleine-König, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni
  Cc: Grygorii Strashko, Marc Kleine-Budde, Nathan Chancellor,
	Nathan Huckleberry, Geert Uytterhoeven, Bhupesh Sharma, Wei Fang,
	Andrew Lunn, Rob Herring, Thomas Gleixner,
	Sebastian Andrzej Siewior, Arnd Bergmann, netdev, kernel,
	linux-omap

On 9/18/23 13:42, Uwe Kleine-König wrote:
> The .remove() callback for a platform driver returns an int which makes
> many driver authors wrongly assume it's possible to do error handling by
> returning an error code. However the value returned is ignored (apart
> from emitting a warning) and this typically results in resource leaks.
> To improve here there is a quest to make the remove callback return
> void. In the first step of this quest all drivers are converted to
> .remove_new() which already returns void. Eventually after all drivers
> are converted, .remove_new() is renamed to .remove().
> 
> Trivially convert these drivers from always returning zero in the remove
> callback to the void returning variant.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---
>   drivers/net/ethernet/ti/cpmac.c        | 6 ++----

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> # cpmac
-- 
Florian


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

* Re: [PATCH net-next 11/54] net: ethernet: broadcom: Convert to platform remove callback returning void
  2023-09-18 20:41 ` [PATCH net-next 11/54] net: ethernet: broadcom: " Uwe Kleine-König
@ 2023-09-18 20:55   ` Florian Fainelli
  0 siblings, 0 replies; 70+ messages in thread
From: Florian Fainelli @ 2023-09-18 20:55 UTC (permalink / raw)
  To: Uwe Kleine-König, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni
  Cc: Justin Chen, Rafał Miłecki,
	Broadcom internal kernel review list, Doug Berger, Li Zetao,
	Steen Hegelund, Lukas Bulwahn, netdev, kernel

[-- Attachment #1: Type: text/plain, Size: 872 bytes --]

On 9/18/23 13:41, Uwe Kleine-König wrote:
> The .remove() callback for a platform driver returns an int which makes
> many driver authors wrongly assume it's possible to do error handling by
> returning an error code. However the value returned is ignored (apart
> from emitting a warning) and this typically results in resource leaks.
> To improve here there is a quest to make the remove callback return
> void. In the first step of this quest all drivers are converted to
> .remove_new() which already returns void. Eventually after all drivers
> are converted, .remove_new() is renamed to .remove().
> 
> Trivially convert these drivers from always returning zero in the remove
> callback to the void returning variant.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
-- 
Florian


[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4221 bytes --]

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

* Re: [PATCH net-next 40/54] net: ethernet: qualcomm: Convert to platform remove callback returning void
  2023-09-18 20:42 ` [PATCH net-next 40/54] net: ethernet: qualcomm: " Uwe Kleine-König
@ 2023-09-19  0:29   ` Timur Tabi
  0 siblings, 0 replies; 70+ messages in thread
From: Timur Tabi @ 2023-09-19  0:29 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Timur Tabi, netdev, kernel

On Mon, Sep 18, 2023 at 3:43 PM Uwe Kleine-König
<u.kleine-koenig@pengutronix.de> wrote:
> Trivially convert this driver from always returning zero in the remove
> callback to the void returning variant.
>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

Acked-by: Timur Tabi <timur@kernel.org>

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

* RE: [PATCH net-next 53/54] net: ethernet: xilinx: Convert to platform remove callback returning void
  2023-09-18 20:42 ` [PATCH net-next 53/54] net: ethernet: xilinx: " Uwe Kleine-König
@ 2023-09-19  4:45   ` Pandey, Radhey Shyam
  2023-09-19  8:33     ` Uwe Kleine-König
  0 siblings, 1 reply; 70+ messages in thread
From: Pandey, Radhey Shyam @ 2023-09-19  4:45 UTC (permalink / raw)
  To: Uwe Kleine-König, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni
  Cc: Simek, Michal, Katakam, Harini, Haoyue Xu, huangjunxian,
	Rob Herring, Yang Yingliang, Dan Carpenter, Bhupesh Sharma,
	Simon Horman, Alex Elder, Wei Fang, netdev@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, kernel@pengutronix.de

> -----Original Message-----
> From: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> Sent: Tuesday, September 19, 2023 2:12 AM
> To: David S. Miller <davem@davemloft.net>; Eric Dumazet
> <edumazet@google.com>; Jakub Kicinski <kuba@kernel.org>; Paolo Abeni
> <pabeni@redhat.com>
> Cc: Simek, Michal <michal.simek@amd.com>; Pandey, Radhey Shyam
> <radhey.shyam.pandey@amd.com>; Katakam, Harini
> <harini.katakam@amd.com>; Haoyue Xu <xuhaoyue1@hisilicon.com>;
> huangjunxian <huangjunxian6@hisilicon.com>; Rob Herring
> <robh@kernel.org>; Yang Yingliang <yangyingliang@huawei.com>; Dan
> Carpenter <dan.carpenter@linaro.org>; Bhupesh Sharma
> <bhupesh.sharma@linaro.org>; Simon Horman <horms@kernel.org>; Alex
> Elder <elder@linaro.org>; Wei Fang <wei.fang@nxp.com>;
> netdev@vger.kernel.org; linux-arm-kernel@lists.infradead.org;
> kernel@pengutronix.de
> Subject: [PATCH net-next 53/54] net: ethernet: xilinx: Convert to platform
> remove callback returning void
> 
> The .remove() callback for a platform driver returns an int which makes
> many driver authors wrongly assume it's possible to do error handling by
> returning an error code. However the value returned is ignored (apart
> from emitting a warning) and this typically results in resource leaks.
> To improve here there is a quest to make the remove callback return
> void. In the first step of this quest all drivers are converted to
> .remove_new() which already returns void. Eventually after all drivers
> are converted, .remove_new() is renamed to .remove().
> 
> Trivially convert these drivers from always returning zero in the remove
> callback to the void returning variant.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---
>  drivers/net/ethernet/xilinx/ll_temac_main.c       | 5 ++---
>  drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 6 ++----
>  drivers/net/ethernet/xilinx/xilinx_emaclite.c     | 6 ++----
>  3 files changed, 6 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/net/ethernet/xilinx/ll_temac_main.c
> b/drivers/net/ethernet/xilinx/ll_temac_main.c
> index 1444b855e7aa..9df39cf8b097 100644
> --- a/drivers/net/ethernet/xilinx/ll_temac_main.c
> +++ b/drivers/net/ethernet/xilinx/ll_temac_main.c
> @@ -1626,7 +1626,7 @@ static int temac_probe(struct platform_device
> *pdev)
>  	return rc;
>  }
> 
> -static int temac_remove(struct platform_device *pdev)
> +static void temac_remove(struct platform_device *pdev)
>  {
>  	struct net_device *ndev = platform_get_drvdata(pdev);
>  	struct temac_local *lp = netdev_priv(ndev);
> @@ -1636,7 +1636,6 @@ static int temac_remove(struct platform_device
> *pdev)
>  	if (lp->phy_node)
>  		of_node_put(lp->phy_node);
>  	temac_mdio_teardown(lp);
> -	return 0;
>  }
> 
>  static const struct of_device_id temac_of_match[] = {
> @@ -1650,7 +1649,7 @@ MODULE_DEVICE_TABLE(of, temac_of_match);
> 
>  static struct platform_driver temac_driver = {
>  	.probe = temac_probe,
> -	.remove = temac_remove,
> +	.remove_new = temac_remove,
>  	.driver = {
>  		.name = "xilinx_temac",
>  		.of_match_table = temac_of_match,
> diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
> b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
> index b7ec4dafae90..82d0d44b2b02 100644
> --- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
> +++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
> @@ -2183,7 +2183,7 @@ static int axienet_probe(struct platform_device
> *pdev)
>  	return ret;
>  }
> 
> -static int axienet_remove(struct platform_device *pdev)
> +static void axienet_remove(struct platform_device *pdev)
>  {
>  	struct net_device *ndev = platform_get_drvdata(pdev);
>  	struct axienet_local *lp = netdev_priv(ndev);
> @@ -2202,8 +2202,6 @@ static int axienet_remove(struct platform_device
> *pdev)
>  	clk_disable_unprepare(lp->axi_clk);
> 
>  	free_netdev(ndev);
> -
> -	return 0;
>  }
> 
>  static void axienet_shutdown(struct platform_device *pdev)
> @@ -2256,7 +2254,7 @@ static
> DEFINE_SIMPLE_DEV_PM_OPS(axienet_pm_ops,
> 
>  static struct platform_driver axienet_driver = {
>  	.probe = axienet_probe,
> -	.remove = axienet_remove,
> +	.remove_new = axienet_remove,
>  	.shutdown = axienet_shutdown,
>  	.driver = {
>  		 .name = "xilinx_axienet",
> diff --git a/drivers/net/ethernet/xilinx/xilinx_emaclite.c
> b/drivers/net/ethernet/xilinx/xilinx_emaclite.c
> index b358ecc67227..32a502e7318b 100644
> --- a/drivers/net/ethernet/xilinx/xilinx_emaclite.c
> +++ b/drivers/net/ethernet/xilinx/xilinx_emaclite.c
> @@ -1183,7 +1183,7 @@ static int xemaclite_of_probe(struct
> platform_device *ofdev)
>   *
>   * Return:	0, always.
>   */

Nit - kernel-doc return documentation needs to be updated.

> -static int xemaclite_of_remove(struct platform_device *of_dev)
> +static void xemaclite_of_remove(struct platform_device *of_dev)
>  {
>  	struct net_device *ndev = platform_get_drvdata(of_dev);
> 
> @@ -1202,8 +1202,6 @@ static int xemaclite_of_remove(struct
> platform_device *of_dev)
>  	lp->phy_node = NULL;
> 
>  	free_netdev(ndev);
> -
> -	return 0;
>  }
> 
>  #ifdef CONFIG_NET_POLL_CONTROLLER
> @@ -1262,7 +1260,7 @@ static struct platform_driver xemaclite_of_driver =
> {
>  		.of_match_table = xemaclite_of_match,
>  	},
>  	.probe		= xemaclite_of_probe,
> -	.remove		= xemaclite_of_remove,
> +	.remove_new	= xemaclite_of_remove,
>  };
> 
>  module_platform_driver(xemaclite_of_driver);
> --
> 2.40.1


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

* Re: [PATCH net-next 12/54] net: ethernet: cadence: Convert to platform remove callback returning void
  2023-09-18 20:41 ` [PATCH net-next 12/54] net: ethernet: cadence: " Uwe Kleine-König
@ 2023-09-19  6:00   ` claudiu beznea
  0 siblings, 0 replies; 70+ messages in thread
From: claudiu beznea @ 2023-09-19  6:00 UTC (permalink / raw)
  To: Uwe Kleine-König, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni
  Cc: Nicolas Ferre, Russell King, netdev, kernel



On 18.09.2023 23:41, Uwe Kleine-König wrote:
> The .remove() callback for a platform driver returns an int which makes
> many driver authors wrongly assume it's possible to do error handling by
> returning an error code. However the value returned is ignored (apart
> from emitting a warning) and this typically results in resource leaks.
> To improve here there is a quest to make the remove callback return
> void. In the first step of this quest all drivers are converted to
> .remove_new() which already returns void. Eventually after all drivers
> are converted, .remove_new() is renamed to .remove().
> 
> Trivially convert this driver from always returning zero in the remove
> callback to the void returning variant.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

Reviewed-by: Claudiu Beznea <claudiu.beznea@tuxon.dev>

> ---
>  drivers/net/ethernet/cadence/macb_main.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c
> index b940dcd3ace6..cebae0f418f2 100644
> --- a/drivers/net/ethernet/cadence/macb_main.c
> +++ b/drivers/net/ethernet/cadence/macb_main.c
> @@ -5156,7 +5156,7 @@ static int macb_probe(struct platform_device *pdev)
>  	return err;
>  }
>  
> -static int macb_remove(struct platform_device *pdev)
> +static void macb_remove(struct platform_device *pdev)
>  {
>  	struct net_device *dev;
>  	struct macb *bp;
> @@ -5181,8 +5181,6 @@ static int macb_remove(struct platform_device *pdev)
>  		phylink_destroy(bp->phylink);
>  		free_netdev(dev);
>  	}
> -
> -	return 0;
>  }
>  
>  static int __maybe_unused macb_suspend(struct device *dev)
> @@ -5398,7 +5396,7 @@ static const struct dev_pm_ops macb_pm_ops = {
>  
>  static struct platform_driver macb_driver = {
>  	.probe		= macb_probe,
> -	.remove		= macb_remove,
> +	.remove_new	= macb_remove,
>  	.driver		= {
>  		.name		= "macb",
>  		.of_match_table	= of_match_ptr(macb_dt_ids),

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

* Re: [PATCH net-next 41/54] net: ethernet: renesas: Convert to platform remove callback returning void
  2023-09-18 20:42 ` [PATCH net-next 41/54] net: ethernet: renesas: " Uwe Kleine-König
@ 2023-09-19  6:58   ` Geert Uytterhoeven
  2023-09-19 17:28   ` Sergey Shtylyov
  2023-09-20  0:02   ` Yoshihiro Shimoda
  2 siblings, 0 replies; 70+ messages in thread
From: Geert Uytterhoeven @ 2023-09-19  6:58 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Sergey Shtylyov, Geert Uytterhoeven, Yoshihiro Shimoda,
	Simon Horman, Wolfram Sang, Biju Das, Alexander Duyck,
	Michael Walle, Rob Herring, Andrew Lunn, netdev,
	linux-renesas-soc, kernel

On Mon, Sep 18, 2023 at 10:42 PM Uwe Kleine-König
<u.kleine-koenig@pengutronix.de> wrote:
> The .remove() callback for a platform driver returns an int which makes
> many driver authors wrongly assume it's possible to do error handling by
> returning an error code. However the value returned is ignored (apart
> from emitting a warning) and this typically results in resource leaks.
> To improve here there is a quest to make the remove callback return
> void. In the first step of this quest all drivers are converted to
> .remove_new() which already returns void. Eventually after all drivers
> are converted, .remove_new() is renamed to .remove().
>
> Trivially convert these drivers from always returning zero in the remove
> callback to the void returning variant.
>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

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

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

* Re: [PATCH net-next 31/54] net: ethernet: mellanox: Convert to platform remove callback returning void
  2023-09-18 20:42 ` [PATCH net-next 31/54] net: ethernet: mellanox: " Uwe Kleine-König
@ 2023-09-19  8:21   ` Leon Romanovsky
  0 siblings, 0 replies; 70+ messages in thread
From: Leon Romanovsky @ 2023-09-19  8:21 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Asmaa Mnebhi, David Thompson, Andrew Lunn, netdev, kernel

On Mon, Sep 18, 2023 at 10:42:03PM +0200, Uwe Kleine-König wrote:
> The .remove() callback for a platform driver returns an int which makes
> many driver authors wrongly assume it's possible to do error handling by
> returning an error code. However the value returned is ignored (apart
> from emitting a warning) and this typically results in resource leaks.
> To improve here there is a quest to make the remove callback return
> void. In the first step of this quest all drivers are converted to
> .remove_new() which already returns void. Eventually after all drivers
> are converted, .remove_new() is renamed to .remove().
> 
> Trivially convert this driver from always returning zero in the remove
> callback to the void returning variant.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---
>  drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_main.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 

Thanks,
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>

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

* Re: [PATCH net-next 53/54] net: ethernet: xilinx: Convert to platform remove callback returning void
  2023-09-19  4:45   ` Pandey, Radhey Shyam
@ 2023-09-19  8:33     ` Uwe Kleine-König
  0 siblings, 0 replies; 70+ messages in thread
From: Uwe Kleine-König @ 2023-09-19  8:33 UTC (permalink / raw)
  To: Pandey, Radhey Shyam
  Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Katakam, Harini, Rob Herring, kernel@pengutronix.de,
	Bhupesh Sharma, netdev@vger.kernel.org, Alex Elder, Simon Horman,
	Wei Fang, linux-arm-kernel@lists.infradead.org, huangjunxian,
	Yang Yingliang, Simek, Michal, Haoyue Xu, Dan Carpenter

[-- Attachment #1: Type: text/plain, Size: 5498 bytes --]

Hello,

[dropped Bhupesh Sharma from the list of recipents, usage of their email
address resulted in a bounce.]

On Tue, Sep 19, 2023 at 04:45:04AM +0000, Pandey, Radhey Shyam wrote:
> > -----Original Message-----
> > From: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> > Sent: Tuesday, September 19, 2023 2:12 AM
> > To: David S. Miller <davem@davemloft.net>; Eric Dumazet
> > <edumazet@google.com>; Jakub Kicinski <kuba@kernel.org>; Paolo Abeni
> > <pabeni@redhat.com>
> > Cc: Simek, Michal <michal.simek@amd.com>; Pandey, Radhey Shyam
> > <radhey.shyam.pandey@amd.com>; Katakam, Harini
> > <harini.katakam@amd.com>; Haoyue Xu <xuhaoyue1@hisilicon.com>;
> > huangjunxian <huangjunxian6@hisilicon.com>; Rob Herring
> > <robh@kernel.org>; Yang Yingliang <yangyingliang@huawei.com>; Dan
> > Carpenter <dan.carpenter@linaro.org>; Bhupesh Sharma
> > <bhupesh.sharma@linaro.org>; Simon Horman <horms@kernel.org>; Alex
> > Elder <elder@linaro.org>; Wei Fang <wei.fang@nxp.com>;
> > netdev@vger.kernel.org; linux-arm-kernel@lists.infradead.org;
> > kernel@pengutronix.de
> > Subject: [PATCH net-next 53/54] net: ethernet: xilinx: Convert to platform
> > remove callback returning void
> > 
> > The .remove() callback for a platform driver returns an int which makes
> > many driver authors wrongly assume it's possible to do error handling by
> > returning an error code. However the value returned is ignored (apart
> > from emitting a warning) and this typically results in resource leaks.
> > To improve here there is a quest to make the remove callback return
> > void. In the first step of this quest all drivers are converted to
> > .remove_new() which already returns void. Eventually after all drivers
> > are converted, .remove_new() is renamed to .remove().
> > 
> > Trivially convert these drivers from always returning zero in the remove
> > callback to the void returning variant.
> > 
> > Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> > ---
> >  drivers/net/ethernet/xilinx/ll_temac_main.c       | 5 ++---
> >  drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 6 ++----
> >  drivers/net/ethernet/xilinx/xilinx_emaclite.c     | 6 ++----
> >  3 files changed, 6 insertions(+), 11 deletions(-)
> > 
> > diff --git a/drivers/net/ethernet/xilinx/ll_temac_main.c
> > b/drivers/net/ethernet/xilinx/ll_temac_main.c
> > index 1444b855e7aa..9df39cf8b097 100644
> > --- a/drivers/net/ethernet/xilinx/ll_temac_main.c
> > +++ b/drivers/net/ethernet/xilinx/ll_temac_main.c
> > @@ -1626,7 +1626,7 @@ static int temac_probe(struct platform_device
> > *pdev)
> >  	return rc;
> >  }
> > 
> > -static int temac_remove(struct platform_device *pdev)
> > +static void temac_remove(struct platform_device *pdev)
> >  {
> >  	struct net_device *ndev = platform_get_drvdata(pdev);
> >  	struct temac_local *lp = netdev_priv(ndev);
> > @@ -1636,7 +1636,6 @@ static int temac_remove(struct platform_device
> > *pdev)
> >  	if (lp->phy_node)
> >  		of_node_put(lp->phy_node);
> >  	temac_mdio_teardown(lp);
> > -	return 0;
> >  }
> > 
> >  static const struct of_device_id temac_of_match[] = {
> > @@ -1650,7 +1649,7 @@ MODULE_DEVICE_TABLE(of, temac_of_match);
> > 
> >  static struct platform_driver temac_driver = {
> >  	.probe = temac_probe,
> > -	.remove = temac_remove,
> > +	.remove_new = temac_remove,
> >  	.driver = {
> >  		.name = "xilinx_temac",
> >  		.of_match_table = temac_of_match,
> > diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
> > b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
> > index b7ec4dafae90..82d0d44b2b02 100644
> > --- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
> > +++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
> > @@ -2183,7 +2183,7 @@ static int axienet_probe(struct platform_device
> > *pdev)
> >  	return ret;
> >  }
> > 
> > -static int axienet_remove(struct platform_device *pdev)
> > +static void axienet_remove(struct platform_device *pdev)
> >  {
> >  	struct net_device *ndev = platform_get_drvdata(pdev);
> >  	struct axienet_local *lp = netdev_priv(ndev);
> > @@ -2202,8 +2202,6 @@ static int axienet_remove(struct platform_device
> > *pdev)
> >  	clk_disable_unprepare(lp->axi_clk);
> > 
> >  	free_netdev(ndev);
> > -
> > -	return 0;
> >  }
> > 
> >  static void axienet_shutdown(struct platform_device *pdev)
> > @@ -2256,7 +2254,7 @@ static
> > DEFINE_SIMPLE_DEV_PM_OPS(axienet_pm_ops,
> > 
> >  static struct platform_driver axienet_driver = {
> >  	.probe = axienet_probe,
> > -	.remove = axienet_remove,
> > +	.remove_new = axienet_remove,
> >  	.shutdown = axienet_shutdown,
> >  	.driver = {
> >  		 .name = "xilinx_axienet",
> > diff --git a/drivers/net/ethernet/xilinx/xilinx_emaclite.c
> > b/drivers/net/ethernet/xilinx/xilinx_emaclite.c
> > index b358ecc67227..32a502e7318b 100644
> > --- a/drivers/net/ethernet/xilinx/xilinx_emaclite.c
> > +++ b/drivers/net/ethernet/xilinx/xilinx_emaclite.c
> > @@ -1183,7 +1183,7 @@ static int xemaclite_of_probe(struct
> > platform_device *ofdev)
> >   *
> >   * Return:	0, always.
> >   */
> 
> Nit - kernel-doc return documentation needs to be updated.

Indeed, I fixed that in my tree and so it will be addressed if and when
I resend this patch.

Thanks
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH net-next 04/54] net: ethernet: allwinner: Convert to platform remove callback returning void
  2023-09-18 20:41 ` [PATCH net-next 04/54] net: ethernet: allwinner: " Uwe Kleine-König
@ 2023-09-19 17:22   ` Jernej Škrabec
  0 siblings, 0 replies; 70+ messages in thread
From: Jernej Škrabec @ 2023-09-19 17:22 UTC (permalink / raw)
  To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Uwe Kleine-König
  Cc: Chen-Yu Tsai, Samuel Holland, netdev, linux-arm-kernel,
	linux-sunxi, kernel

Dne ponedeljek, 18. september 2023 ob 22:41:36 CEST je Uwe Kleine-König 
napisal(a):
> The .remove() callback for a platform driver returns an int which makes
> many driver authors wrongly assume it's possible to do error handling by
> returning an error code. However the value returned is ignored (apart
> from emitting a warning) and this typically results in resource leaks.
> To improve here there is a quest to make the remove callback return
> void. In the first step of this quest all drivers are converted to
> .remove_new() which already returns void. Eventually after all drivers
> are converted, .remove_new() is renamed to .remove().
> 
> Trivially convert this driver from always returning zero in the remove
> callback to the void returning variant.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

Acked-by: Jernej Skrabec <jernej.skrabec@gmail.com>

Best regards,
Jernej

> ---
>  drivers/net/ethernet/allwinner/sun4i-emac.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/net/ethernet/allwinner/sun4i-emac.c
> b/drivers/net/ethernet/allwinner/sun4i-emac.c index
> a94c62956eed..d761c08fe5c1 100644
> --- a/drivers/net/ethernet/allwinner/sun4i-emac.c
> +++ b/drivers/net/ethernet/allwinner/sun4i-emac.c
> @@ -1083,7 +1083,7 @@ static int emac_probe(struct platform_device *pdev)
>  	return ret;
>  }
> 
> -static int emac_remove(struct platform_device *pdev)
> +static void emac_remove(struct platform_device *pdev)
>  {
>  	struct net_device *ndev = platform_get_drvdata(pdev);
>  	struct emac_board_info *db = netdev_priv(ndev);
> @@ -1101,7 +1101,6 @@ static int emac_remove(struct platform_device *pdev)
>  	free_netdev(ndev);
> 
>  	dev_dbg(&pdev->dev, "released and freed device\n");
> -	return 0;
>  }
> 
>  static int emac_suspend(struct platform_device *dev, pm_message_t state)
> @@ -1143,7 +1142,7 @@ static struct platform_driver emac_driver = {
>  		.of_match_table = emac_of_match,
>  	},
>  	.probe = emac_probe,
> -	.remove = emac_remove,
> +	.remove_new = emac_remove,
>  	.suspend = emac_suspend,
>  	.resume = emac_resume,
>  };





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

* Re: [PATCH net-next 41/54] net: ethernet: renesas: Convert to platform remove callback returning void
  2023-09-18 20:42 ` [PATCH net-next 41/54] net: ethernet: renesas: " Uwe Kleine-König
  2023-09-19  6:58   ` Geert Uytterhoeven
@ 2023-09-19 17:28   ` Sergey Shtylyov
  2023-09-20  0:02   ` Yoshihiro Shimoda
  2 siblings, 0 replies; 70+ messages in thread
From: Sergey Shtylyov @ 2023-09-19 17:28 UTC (permalink / raw)
  To: Uwe Kleine-König, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni
  Cc: Geert Uytterhoeven, Yoshihiro Shimoda, Simon Horman, Wolfram Sang,
	Biju Das, Alexander Duyck, Michael Walle, Rob Herring,
	Andrew Lunn, netdev, linux-renesas-soc, kernel

Hello!

On 9/18/23 11:42 PM, Uwe Kleine-König wrote:

> The .remove() callback for a platform driver returns an int which makes
> many driver authors wrongly assume it's possible to do error handling by
> returning an error code. However the value returned is ignored (apart
> from emitting a warning) and this typically results in resource leaks.
> To improve here there is a quest to make the remove callback return
> void. In the first step of this quest all drivers are converted to
> .remove_new() which already returns void. Eventually after all drivers
> are converted, .remove_new() is renamed to .remove().
> 
> Trivially convert these drivers from always returning zero in the remove
> callback to the void returning variant.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
[...]
> diff --git a/drivers/net/ethernet/renesas/rswitch.c b/drivers/net/ethernet/renesas/rswitch.c
> index ea9186178091..3c165b15709f 100644
> --- a/drivers/net/ethernet/renesas/rswitch.c
> +++ b/drivers/net/ethernet/renesas/rswitch.c

   Hm, I still need to do a patch clarifying that I don't do rswitch reviews --
I'm not familiar with that hardware and don't have the manuals ATM...

[...]

Reviewed-by: Sergey Shtylyov <s.shtylyov@omp.ru>

[...]

MBR, Sergey

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

* RE: [PATCH net-next 41/54] net: ethernet: renesas: Convert to platform remove callback returning void
  2023-09-18 20:42 ` [PATCH net-next 41/54] net: ethernet: renesas: " Uwe Kleine-König
  2023-09-19  6:58   ` Geert Uytterhoeven
  2023-09-19 17:28   ` Sergey Shtylyov
@ 2023-09-20  0:02   ` Yoshihiro Shimoda
  2 siblings, 0 replies; 70+ messages in thread
From: Yoshihiro Shimoda @ 2023-09-20  0:02 UTC (permalink / raw)
  To: Uwe Kleine-König, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni
  Cc: Sergey Shtylyov, Geert Uytterhoeven, Simon Horman, Wolfram Sang,
	Biju Das, Alexander Duyck, Michael Walle, Rob Herring,
	Andrew Lunn, netdev@vger.kernel.org,
	linux-renesas-soc@vger.kernel.org, kernel@pengutronix.de

Hi Uwe,

> From: Uwe Kleine-König, Sent: Tuesday, September 19, 2023 5:42 AM
> 
> The .remove() callback for a platform driver returns an int which makes
> many driver authors wrongly assume it's possible to do error handling by
> returning an error code. However the value returned is ignored (apart
> from emitting a warning) and this typically results in resource leaks.
> To improve here there is a quest to make the remove callback return
> void. In the first step of this quest all drivers are converted to
> .remove_new() which already returns void. Eventually after all drivers
> are converted, .remove_new() is renamed to .remove().
> 
> Trivially convert these drivers from always returning zero in the remove
> callback to the void returning variant.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

Thank you for the patch!

Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>

Best regards,
Yoshihiro Shimoda

> ---
>  drivers/net/ethernet/renesas/ravb_main.c | 6 ++----
>  drivers/net/ethernet/renesas/rswitch.c   | 6 ++----
>  drivers/net/ethernet/renesas/sh_eth.c    | 6 ++----
>  3 files changed, 6 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
> index 7df9f9f8e134..e62391180032 100644
> --- a/drivers/net/ethernet/renesas/ravb_main.c
> +++ b/drivers/net/ethernet/renesas/ravb_main.c
> @@ -2878,7 +2878,7 @@ static int ravb_probe(struct platform_device *pdev)
>  	return error;
>  }
> 
> -static int ravb_remove(struct platform_device *pdev)
> +static void ravb_remove(struct platform_device *pdev)
>  {
>  	struct net_device *ndev = platform_get_drvdata(pdev);
>  	struct ravb_private *priv = netdev_priv(ndev);
> @@ -2905,8 +2905,6 @@ static int ravb_remove(struct platform_device *pdev)
>  	reset_control_assert(priv->rstc);
>  	free_netdev(ndev);
>  	platform_set_drvdata(pdev, NULL);
> -
> -	return 0;
>  }
> 
>  static int ravb_wol_setup(struct net_device *ndev)
> @@ -3044,7 +3042,7 @@ static const struct dev_pm_ops ravb_dev_pm_ops = {
> 
>  static struct platform_driver ravb_driver = {
>  	.probe		= ravb_probe,
> -	.remove		= ravb_remove,
> +	.remove_new	= ravb_remove,
>  	.driver = {
>  		.name	= "ravb",
>  		.pm	= &ravb_dev_pm_ops,
> diff --git a/drivers/net/ethernet/renesas/rswitch.c b/drivers/net/ethernet/renesas/rswitch.c
> index ea9186178091..3c165b15709f 100644
> --- a/drivers/net/ethernet/renesas/rswitch.c
> +++ b/drivers/net/ethernet/renesas/rswitch.c
> @@ -1968,7 +1968,7 @@ static void rswitch_deinit(struct rswitch_private *priv)
>  	rswitch_clock_disable(priv);
>  }
> 
> -static int renesas_eth_sw_remove(struct platform_device *pdev)
> +static void renesas_eth_sw_remove(struct platform_device *pdev)
>  {
>  	struct rswitch_private *priv = platform_get_drvdata(pdev);
> 
> @@ -1978,13 +1978,11 @@ static int renesas_eth_sw_remove(struct platform_device *pdev)
>  	pm_runtime_disable(&pdev->dev);
> 
>  	platform_set_drvdata(pdev, NULL);
> -
> -	return 0;
>  }
> 
>  static struct platform_driver renesas_eth_sw_driver_platform = {
>  	.probe = renesas_eth_sw_probe,
> -	.remove = renesas_eth_sw_remove,
> +	.remove_new = renesas_eth_sw_remove,
>  	.driver = {
>  		.name = "renesas_eth_sw",
>  		.of_match_table = renesas_eth_sw_of_table,
> diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
> index 274ea16c0a1f..475e1e8c1d35 100644
> --- a/drivers/net/ethernet/renesas/sh_eth.c
> +++ b/drivers/net/ethernet/renesas/sh_eth.c
> @@ -3431,7 +3431,7 @@ static int sh_eth_drv_probe(struct platform_device *pdev)
>  	return ret;
>  }
> 
> -static int sh_eth_drv_remove(struct platform_device *pdev)
> +static void sh_eth_drv_remove(struct platform_device *pdev)
>  {
>  	struct net_device *ndev = platform_get_drvdata(pdev);
>  	struct sh_eth_private *mdp = netdev_priv(ndev);
> @@ -3441,8 +3441,6 @@ static int sh_eth_drv_remove(struct platform_device *pdev)
>  	sh_mdio_release(mdp);
>  	pm_runtime_disable(&pdev->dev);
>  	free_netdev(ndev);
> -
> -	return 0;
>  }
> 
>  #ifdef CONFIG_PM
> @@ -3562,7 +3560,7 @@ MODULE_DEVICE_TABLE(platform, sh_eth_id_table);
> 
>  static struct platform_driver sh_eth_driver = {
>  	.probe = sh_eth_drv_probe,
> -	.remove = sh_eth_drv_remove,
> +	.remove_new = sh_eth_drv_remove,
>  	.id_table = sh_eth_id_table,
>  	.driver = {
>  		   .name = CARDNAME,
> --
> 2.40.1


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

* Re: [PATCH net-next 54/54] net: ethernet: xscale: Convert to platform remove callback returning void
  2023-09-18 20:42 ` [PATCH net-next 54/54] net: ethernet: xscale: " Uwe Kleine-König
@ 2023-09-20  7:52   ` Krzysztof Hałasa
  2023-09-20  9:20     ` Linus Walleij
  0 siblings, 1 reply; 70+ messages in thread
From: Krzysztof Hałasa @ 2023-09-20  7:52 UTC (permalink / raw)
  To: Uwe Kleine-König, Linus Walleij
  Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	netdev, kernel

Hello Uwe, Linus,

Uwe Kleine-König <u.kleine-koenig@pengutronix.de> writes:

> The .remove() callback for a platform driver returns an int which makes
> many driver authors wrongly assume it's possible to do error handling by
> returning an error code. However the value returned is ignored (apart
> from emitting a warning) and this typically results in resource leaks.
> To improve here there is a quest to make the remove callback return
> void. In the first step of this quest all drivers are converted to
> .remove_new() which already returns void. Eventually after all drivers
> are converted, .remove_new() is renamed to .remove().
>
> Trivially convert this driver from always returning zero in the remove
> callback to the void returning variant.

This makes perfect sense of course.

BTW, Linus, this is a separate entry in MAINTAINERS (INTEL IXP4XX QMGR,
NPE, ETHERNET and HSS SUPPORT). Perhaps you'd want it as well?
While I still have access to IXP425 and IXP435 hw, I haven't (literally)
touched them in years, so I guess there is very little reason (or rather
none at all) for me to linger as a maintainer of anything related to
IPX4xx anymore. If you wish, I can prepare a MAINTAINERS patch, or
something.

> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

Acked-by: Krzysztof Hałasa <khalasa@piap.pl>

> ---
>  drivers/net/ethernet/xscale/ixp4xx_eth.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)

-- 
Krzysztof "Chris" Hałasa

Sieć Badawcza Łukasiewicz
Przemysłowy Instytut Automatyki i Pomiarów PIAP
Al. Jerozolimskie 202, 02-486 Warszawa

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

* Re: [PATCH net-next 00/54] net: ethernet: Convert to platform remove callback returning void
  2023-09-18 20:41 [PATCH net-next 00/54] net: ethernet: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (53 preceding siblings ...)
  2023-09-18 20:42 ` [PATCH net-next 54/54] net: ethernet: xscale: " Uwe Kleine-König
@ 2023-09-20  8:10 ` patchwork-bot+netdevbpf
  54 siblings, 0 replies; 70+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-09-20  8:10 UTC (permalink / raw)
  To: =?utf-8?q?Uwe_Kleine-K=C3=B6nig_=3Cu=2Ekleine-koenig=40pengutronix=2Ede=3E?=
  Cc: davem, edumazet, kuba, pabeni, grygorii.strashko, linux-omap,
	bagasdotme, yangyingliang, gerg, arnd, netdev, kernel, afaerber,
	mani, linux-arm-kernel, linux-actions, andreas, wens,
	jernej.skrabec, samuel, linux-sunxi, joyce.ooi, Shyam-sundar.S-k,
	bhupesh.sharma, elder, wei.fang, robh, iyappan, keyur, quan,
	rauji.raut, heiko, horms, linux-rockchip, chris.snook,
	justin.chen, florian.fainelli, rafal, bcm-kernel-feedback-list,
	opendmb, lizetao1, Steen.Hegelund, lukas.bulwahn, nicolas.ferre,
	claudiu.beznea, linux, mkl, hsweeten, ruanjinjie, ulli.kroll,
	linus.walleij, kvalo, nhuck, gerhard, maciej.fijalkowski,
	alexanderduyck, fercerpav, saproj, vladimir.oltean, yisen.zhuang,
	salil.mehta, tsbogend, michal.kubiak, dougmill, nathan,
	ruc_gongyuanjun, zhangchangzhong, hauke, kgugala, mholenko,
	gsomlo, joel, sebastian.hesselbarth, thomas.petazzoni, mw,
	michael, andrew, rmk+kernel, krzysztof.kozlowski, nbd, john,
	sean.wang, Mark-MC.Lee, lorenzo, matthias.bgg,
	angelogioacchino.delregno, linux-mediatek, asmaa, davthompson,
	horatiu.vultur, UNGLinuxDriver, lars.povlsen, daniel.machon,
	shangxiaojing, linqiheng, claudiu.manoil, alexandre.belloni,
	YKarpov, vz, timur, s.shtylyov, geert+renesas,
	yoshihiro.shimoda.uh, wsa+renesas, biju.das.jz, linux-renesas-soc,
	bh74.an, ralf, linux-mips, nico, steve.glendinning,
	andriy.shevchenko, jaswinder.singh, ilias.apalodimas,
	hayashi.kunihiko, harshit.m.mogalapalli, wellslutw, f.fainelli,
	tglx, bigeasy, shaozhengchao, kevinbrace, romieu, michal.simek,
	radhey.shyam.pandey, harini.katakam, xuhaoyue1, huangjunxian6,
	dan.carpenter, khalasa

Hello:

This series was applied to netdev/net-next.git (main)
by David S. Miller <davem@davemloft.net>:

On Mon, 18 Sep 2023 22:41:32 +0200 you wrote:
> Hello,
> 
> this series convert nearly all platform drivers below
> drivers/net/ethernet to use remove_new. The motivation is to get rid of
> an integer return code that is (mostly) ignored by the platform driver
> core and error prone on the driver side.
> 
> [...]

Here is the summary with links:
  - [net-next,01/54] net: ethernet: 8390: Convert to platform remove callback returning void
    https://git.kernel.org/netdev/net-next/c/3c000faaaa65
  - [net-next,02/54] net: ethernet: actions: Convert to platform remove callback returning void
    https://git.kernel.org/netdev/net-next/c/d8c6b3fc918d
  - [net-next,03/54] net: ethernet: aeroflex: Convert to platform remove callback returning void
    https://git.kernel.org/netdev/net-next/c/a0fbde8f647b
  - [net-next,04/54] net: ethernet: allwinner: Convert to platform remove callback returning void
    https://git.kernel.org/netdev/net-next/c/9f07797c332e
  - [net-next,05/54] net: ethernet: altera: Convert to platform remove callback returning void
    https://git.kernel.org/netdev/net-next/c/d0b0245b84c9
  - [net-next,06/54] net: ethernet: amd: Convert to platform remove callback returning void
    https://git.kernel.org/netdev/net-next/c/9ecae52f7db4
  - [net-next,07/54] net: ethernet: apm: Convert to platform remove callback returning void
    https://git.kernel.org/netdev/net-next/c/61471264c018
  - [net-next,08/54] net: ethernet: apple: Convert to platform remove callback returning void
    https://git.kernel.org/netdev/net-next/c/e5d0a380b2b4
  - [net-next,09/54] net: ethernet: arc: Convert to platform remove callback returning void
    https://git.kernel.org/netdev/net-next/c/de0afa130ed6
  - [net-next,10/54] net: ethernet: atheros: Convert to platform remove callback returning void
    https://git.kernel.org/netdev/net-next/c/c6e817838902
  - [net-next,11/54] net: ethernet: broadcom: Convert to platform remove callback returning void
    https://git.kernel.org/netdev/net-next/c/d4295df3e043
  - [net-next,12/54] net: ethernet: cadence: Convert to platform remove callback returning void
    https://git.kernel.org/netdev/net-next/c/6b5940402f9c
  - [net-next,13/54] net: ethernet: calxeda: Convert to platform remove callback returning void
    https://git.kernel.org/netdev/net-next/c/ca76b17922e6
  - [net-next,14/54] net: ethernet: cavium: Convert to platform remove callback returning void
    https://git.kernel.org/netdev/net-next/c/de413f46a56e
  - [net-next,15/54] net: ethernet: cirrus: Convert to platform remove callback returning void
    https://git.kernel.org/netdev/net-next/c/8ca0ae6a2ec7
  - [net-next,16/54] net: ethernet: cortina: Convert to platform remove callback returning void
    https://git.kernel.org/netdev/net-next/c/1f69574b5cba
  - [net-next,17/54] net: ethernet: davicom: Convert to platform remove callback returning void
    https://git.kernel.org/netdev/net-next/c/ffb928290ba5
  - [net-next,18/54] net: ethernet: dnet: Convert to platform remove callback returning void
    https://git.kernel.org/netdev/net-next/c/5db6c1fed1f9
  - [net-next,19/54] net: ethernet: engleder: Convert to platform remove callback returning void
    https://git.kernel.org/netdev/net-next/c/d2e6c2ea996e
  - [net-next,20/54] net: ethernet: ethoc: Convert to platform remove callback returning void
    https://git.kernel.org/netdev/net-next/c/4cc08098d197
  - [net-next,21/54] net: ethernet: faraday: Convert to platform remove callback returning void
    https://git.kernel.org/netdev/net-next/c/dc715af33b42
  - [net-next,22/54] net: ethernet: hisilicon: Convert to platform remove callback returning void
    https://git.kernel.org/netdev/net-next/c/e5835a0a5119
  - [net-next,23/54] net: ethernet: i825xx: Convert to platform remove callback returning void
    https://git.kernel.org/netdev/net-next/c/e5a6d397ca2e
  - [net-next,24/54] net: ethernet: ibm: Convert to platform remove callback returning void
    https://git.kernel.org/netdev/net-next/c/ac35a3c4c8da
  - [net-next,25/54] net: ethernet: korina: Convert to platform remove callback returning void
    https://git.kernel.org/netdev/net-next/c/551598a120d1
  - [net-next,26/54] net: ethernet: lantiq_etop: Convert to platform remove callback returning void
    https://git.kernel.org/netdev/net-next/c/e791aa06a2dd
  - [net-next,27/54] net: ethernet: lantiq_xrx200: Convert to platform remove callback returning void
    https://git.kernel.org/netdev/net-next/c/adbb270655a1
  - [net-next,28/54] net: ethernet: litex: Convert to platform remove callback returning void
    https://git.kernel.org/netdev/net-next/c/36b80b8353af
  - [net-next,29/54] net: ethernet: marvell: Convert to platform remove callback returning void
    https://git.kernel.org/netdev/net-next/c/fee02f498c9a
  - [net-next,30/54] net: ethernet: mediatek: Convert to platform remove callback returning void
    https://git.kernel.org/netdev/net-next/c/5b6ce1734d9d
  - [net-next,31/54] net: ethernet: mellanox: Convert to platform remove callback returning void
    https://git.kernel.org/netdev/net-next/c/e184700959ec
  - [net-next,32/54] net: ethernet: micrel: Convert to platform remove callback returning void
    https://git.kernel.org/netdev/net-next/c/bae04ae2be07
  - [net-next,33/54] net: ethernet: microchip: Convert to platform remove callback returning void
    https://git.kernel.org/netdev/net-next/c/5253ae3a6223
  - [net-next,34/54] net: ethernet: moxa:: Convert to platform remove callback returning void
    https://git.kernel.org/netdev/net-next/c/253f9c47273d
  - [net-next,35/54] net: ethernet: mscc: Convert to platform remove callback returning void
    https://git.kernel.org/netdev/net-next/c/0eaca7a9e9d6
  - [net-next,36/54] net: ethernet: natsemi: Convert to platform remove callback returning void
    https://git.kernel.org/netdev/net-next/c/9f0243d9bcc4
  - [net-next,37/54] net: ethernet: natsemi: Convert to platform remove callback returning void
    https://git.kernel.org/netdev/net-next/c/b83fb509c758
  - [net-next,38/54] net: ethernet: ni: Convert to platform remove callback returning void
    https://git.kernel.org/netdev/net-next/c/0f09f4e7d401
  - [net-next,39/54] net: ethernet: nxp: Convert to platform remove callback returning void
    https://git.kernel.org/netdev/net-next/c/241882d79f99
  - [net-next,40/54] net: ethernet: qualcomm: Convert to platform remove callback returning void
    https://git.kernel.org/netdev/net-next/c/5180236592b9
  - [net-next,41/54] net: ethernet: renesas: Convert to platform remove callback returning void
    https://git.kernel.org/netdev/net-next/c/0b4f04e2f60b
  - [net-next,42/54] net: ethernet: samsung: Convert to platform remove callback returning void
    https://git.kernel.org/netdev/net-next/c/6e8b0ef7b389
  - [net-next,43/54] net: ethernet: seeq: Convert to platform remove callback returning void
    https://git.kernel.org/netdev/net-next/c/02c74030beff
  - [net-next,44/54] net: ethernet: sgi: Convert to platform remove callback returning void
    https://git.kernel.org/netdev/net-next/c/506a327ceaaa
  - [net-next,45/54] net: ethernet: smsc: Convert to platform remove callback returning void
    https://git.kernel.org/netdev/net-next/c/e8e2c863f941
  - [net-next,46/54] net: ethernet: socionext: Convert to platform remove callback returning void
    https://git.kernel.org/netdev/net-next/c/d3cd32451c7e
  - [net-next,47/54] net: ethernet: sun: Convert to platform remove callback returning void
    https://git.kernel.org/netdev/net-next/c/8f4e45a0135e
  - [net-next,48/54] net: ethernet: sunplus: Convert to platform remove callback returning void
    https://git.kernel.org/netdev/net-next/c/ede778ed3ea9
  - [net-next,49/54] net: ethernet: ti: Convert to platform remove callback returning void
    https://git.kernel.org/netdev/net-next/c/231ea972ccaf
  - [net-next,50/54] net: ethernet: tundra: Convert to platform remove callback returning void
    https://git.kernel.org/netdev/net-next/c/2f961952e19e
  - [net-next,51/54] net: ethernet: via: Convert to platform remove callback returning void
    https://git.kernel.org/netdev/net-next/c/70680f178280
  - [net-next,52/54] net: ethernet: wiznet: Convert to platform remove callback returning void
    https://git.kernel.org/netdev/net-next/c/46b5668494d0
  - [net-next,53/54] net: ethernet: xilinx: Convert to platform remove callback returning void
    https://git.kernel.org/netdev/net-next/c/2e0ec0afa902
  - [net-next,54/54] net: ethernet: xscale: Convert to platform remove callback returning void
    https://git.kernel.org/netdev/net-next/c/d74a5c154b6f

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

* Re: [PATCH net-next 54/54] net: ethernet: xscale: Convert to platform remove callback returning void
  2023-09-20  7:52   ` Krzysztof Hałasa
@ 2023-09-20  9:20     ` Linus Walleij
  0 siblings, 0 replies; 70+ messages in thread
From: Linus Walleij @ 2023-09-20  9:20 UTC (permalink / raw)
  To: Krzysztof Hałasa, Deepak Saxena
  Cc: Uwe Kleine-König, Linus Walleij, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, netdev, kernel

On Wed, Sep 20, 2023 at 9:52 AM Krzysztof Hałasa <khalasa@piap.pl> wrote:

> BTW, Linus, this is a separate entry in MAINTAINERS (INTEL IXP4XX QMGR,
> NPE, ETHERNET and HSS SUPPORT). Perhaps you'd want it as well?

Indeed I guess I should move it all under the IXP4xx platform
simply.

Also Deepak is still listed as maintainer of the RNG
which is inside the NPE, I think he has basically retired
from maintenance as well because I think he mentioned that
he got rid of his IXP4xx hardware.

> While I still have access to IXP425 and IXP435 hw,

Are they supported by the DTS files I created?

> I haven't (literally)
> touched them in years, so I guess there is very little reason (or rather
> none at all) for me to linger as a maintainer of anything related to
> IPX4xx anymore. If you wish, I can prepare a MAINTAINERS patch, or
> something.

Could you group the network and the RNG (which is just below it
in MAINTAINERS) under the architecture (where you are BTW
still listed).

The devices mostly "just work" now though so if you touch them
I bet they will come online nicely. This fork of OpenWrt has all
that's needed to bring up devices:
https://github.com/linusw/openwrt/commits/ixp4xx-v6.1

Yours,
Linus Walleij

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

end of thread, other threads:[~2023-09-20  9:21 UTC | newest]

Thread overview: 70+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-18 20:41 [PATCH net-next 00/54] net: ethernet: Convert to platform remove callback returning void Uwe Kleine-König
2023-09-18 20:41 ` [PATCH net-next 01/54] net: ethernet: 8390: " Uwe Kleine-König
2023-09-18 20:41 ` [PATCH net-next 02/54] net: ethernet: actions: " Uwe Kleine-König
2023-09-18 20:41 ` [PATCH net-next 03/54] net: ethernet: aeroflex: " Uwe Kleine-König
2023-09-18 20:41 ` [PATCH net-next 04/54] net: ethernet: allwinner: " Uwe Kleine-König
2023-09-19 17:22   ` Jernej Škrabec
2023-09-18 20:41 ` [PATCH net-next 05/54] net: ethernet: altera: " Uwe Kleine-König
2023-09-18 20:41 ` [PATCH net-next 06/54] net: ethernet: amd: " Uwe Kleine-König
2023-09-18 20:41 ` [PATCH net-next 07/54] net: ethernet: apm: " Uwe Kleine-König
2023-09-18 20:41 ` [PATCH net-next 08/54] net: ethernet: apple: " Uwe Kleine-König
2023-09-18 20:41 ` [PATCH net-next 09/54] net: ethernet: arc: " Uwe Kleine-König
2023-09-18 20:41 ` [PATCH net-next 10/54] net: ethernet: atheros: " Uwe Kleine-König
2023-09-18 20:41 ` [PATCH net-next 11/54] net: ethernet: broadcom: " Uwe Kleine-König
2023-09-18 20:55   ` Florian Fainelli
2023-09-18 20:41 ` [PATCH net-next 12/54] net: ethernet: cadence: " Uwe Kleine-König
2023-09-19  6:00   ` claudiu beznea
2023-09-18 20:41 ` [PATCH net-next 13/54] net: ethernet: calxeda: " Uwe Kleine-König
2023-09-18 20:41 ` [PATCH net-next 14/54] net: ethernet: cavium: " Uwe Kleine-König
2023-09-18 20:41 ` [PATCH net-next 15/54] net: ethernet: cirrus: " Uwe Kleine-König
2023-09-18 20:41 ` [PATCH net-next 16/54] net: ethernet: cortina: " Uwe Kleine-König
2023-09-18 20:41 ` [PATCH net-next 17/54] net: ethernet: davicom: " Uwe Kleine-König
2023-09-18 20:41 ` [PATCH net-next 18/54] net: ethernet: dnet: " Uwe Kleine-König
2023-09-18 20:41 ` [PATCH net-next 19/54] net: ethernet: engleder: " Uwe Kleine-König
2023-09-18 20:41 ` [PATCH net-next 20/54] net: ethernet: ethoc: " Uwe Kleine-König
2023-09-18 20:41 ` [PATCH net-next 21/54] net: ethernet: faraday: " Uwe Kleine-König
2023-09-18 20:41 ` [PATCH net-next 22/54] net: ethernet: hisilicon: " Uwe Kleine-König
2023-09-18 20:41 ` [PATCH net-next 23/54] net: ethernet: i825xx: " Uwe Kleine-König
2023-09-18 20:41 ` [PATCH net-next 24/54] net: ethernet: ibm: " Uwe Kleine-König
2023-09-18 20:41 ` [PATCH net-next 25/54] net: ethernet: korina: " Uwe Kleine-König
2023-09-18 20:41 ` [PATCH net-next 26/54] net: ethernet: lantiq_etop: " Uwe Kleine-König
2023-09-18 20:41 ` [PATCH net-next 27/54] net: ethernet: lantiq_xrx200: " Uwe Kleine-König
2023-09-18 20:42 ` [PATCH net-next 28/54] net: ethernet: litex: " Uwe Kleine-König
2023-09-18 20:54   ` Gabriel L. Somlo
2023-09-18 20:42 ` [PATCH net-next 29/54] net: ethernet: marvell: " Uwe Kleine-König
2023-09-18 20:42 ` [PATCH net-next 30/54] net: ethernet: mediatek: " Uwe Kleine-König
2023-09-18 20:42 ` [PATCH net-next 31/54] net: ethernet: mellanox: " Uwe Kleine-König
2023-09-19  8:21   ` Leon Romanovsky
2023-09-18 20:42 ` [PATCH net-next 32/54] net: ethernet: micrel: " Uwe Kleine-König
2023-09-18 20:42 ` [PATCH net-next 33/54] net: ethernet: microchip: " Uwe Kleine-König
2023-09-18 20:42 ` [PATCH net-next 34/54] net: ethernet: moxa:: " Uwe Kleine-König
2023-09-18 20:42 ` [PATCH net-next 35/54] net: ethernet: mscc: " Uwe Kleine-König
2023-09-18 20:42 ` [PATCH net-next 36/54] net: ethernet: natsemi: " Uwe Kleine-König
2023-09-18 20:42 ` [PATCH net-next 37/54] " Uwe Kleine-König
2023-09-18 20:42 ` [PATCH net-next 38/54] net: ethernet: ni: " Uwe Kleine-König
2023-09-18 20:42 ` [PATCH net-next 39/54] net: ethernet: nxp: " Uwe Kleine-König
2023-09-18 20:42 ` [PATCH net-next 40/54] net: ethernet: qualcomm: " Uwe Kleine-König
2023-09-19  0:29   ` Timur Tabi
2023-09-18 20:42 ` [PATCH net-next 41/54] net: ethernet: renesas: " Uwe Kleine-König
2023-09-19  6:58   ` Geert Uytterhoeven
2023-09-19 17:28   ` Sergey Shtylyov
2023-09-20  0:02   ` Yoshihiro Shimoda
2023-09-18 20:42 ` [PATCH net-next 42/54] net: ethernet: samsung: " Uwe Kleine-König
2023-09-18 20:42 ` [PATCH net-next 43/54] net: ethernet: seeq: " Uwe Kleine-König
2023-09-18 20:42 ` [PATCH net-next 44/54] net: ethernet: sgi: " Uwe Kleine-König
2023-09-18 20:42 ` [PATCH net-next 45/54] net: ethernet: smsc: " Uwe Kleine-König
2023-09-18 20:42 ` [PATCH net-next 46/54] net: ethernet: socionext: " Uwe Kleine-König
2023-09-18 20:42 ` [PATCH net-next 47/54] net: ethernet: sun: " Uwe Kleine-König
2023-09-18 20:42 ` [PATCH net-next 48/54] net: ethernet: sunplus: " Uwe Kleine-König
2023-09-18 20:42 ` [PATCH net-next 49/54] net: ethernet: ti: " Uwe Kleine-König
2023-09-18 20:54   ` Florian Fainelli
2023-09-18 20:42 ` [PATCH net-next 50/54] net: ethernet: tundra: " Uwe Kleine-König
2023-09-18 20:42 ` [PATCH net-next 51/54] net: ethernet: via: " Uwe Kleine-König
2023-09-18 20:42 ` [PATCH net-next 52/54] net: ethernet: wiznet: " Uwe Kleine-König
2023-09-18 20:42 ` [PATCH net-next 53/54] net: ethernet: xilinx: " Uwe Kleine-König
2023-09-19  4:45   ` Pandey, Radhey Shyam
2023-09-19  8:33     ` Uwe Kleine-König
2023-09-18 20:42 ` [PATCH net-next 54/54] net: ethernet: xscale: " Uwe Kleine-König
2023-09-20  7:52   ` Krzysztof Hałasa
2023-09-20  9:20     ` Linus Walleij
2023-09-20  8:10 ` [PATCH net-next 00/54] net: ethernet: " patchwork-bot+netdevbpf

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