public inbox for linux-tegra@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next 00/11] net: stmmac: Convert to platform remove callback returning void
@ 2023-04-02 14:30 Uwe Kleine-König
  2023-04-02 14:30 ` [PATCH net-next 11/11] net: stmmac: dwmac-tegra: " Uwe Kleine-König
  0 siblings, 1 reply; 4+ messages in thread
From: Uwe Kleine-König @ 2023-04-02 14:30 UTC (permalink / raw)
  To: Giuseppe Cavallaro, Alexandre Torgue, Jose Abreu, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Maxime Coquelin,
	Shawn Guo, Sascha Hauer, Vladimir Zapolskiy, Neil Armstrong,
	Kevin Hilman, Vinod Koul, Chen-Yu Tsai, Jernej Skrabec,
	Samuel Holland, Nobuhiro Iwamatsu, Matthias Brugger,
	Thierry Reding, Jonathan Hunter
  Cc: Fabio Estevam, NXP Linux Team, Jerome Brunet, Martin Blumenstingl,
	Bhupesh Sharma, AngeloGioacchino Del Regno, netdev, linux-stm32,
	linux-arm-kernel, kernel, linux-amlogic, linux-oxnas, linux-sunxi,
	linux-mediatek, linux-tegra

Hello,

this series adapts the platform drivers below
drivers/net/ethernet/stmicro to use the .remove_new() callback. Compared
to the traditional .remove() callback .remove_new() returns no value.
This is a good thing because the driver core doesn't (and cannot) cope
for errors during remove. The only effect of a non-zero return value in
.remove() is that the driver core emits a warning. The device is removed
anyhow and an early return from .remove() usually yields a resource
leak.

The first three commits make sure that the various remove callbacks
(obviously) always return zero. After that all drivers are converted to
.remove_new().

Uwe Kleine-König (11):
  net: stmmac: Make stmmac_pltfr_remove() return void
  net: stmmac: dwmac-visconti: Make visconti_eth_clock_remove() return void
  net: stmmac: dwmac-qcom-ethqos: Drop an if with an always false condition
  net: stmmac: dwmac-visconti: Convert to platform remove callback returning void
  net: stmmac: dwmac-dwc-qos-eth: Convert to platform remove callback returning void
  net: stmmac: dwmac-qcom-ethqos: Convert to platform remove callback returning void
  net: stmmac: dwmac-rk: Convert to platform remove callback returning void
  net: stmmac: dwmac-sti: Convert to platform remove callback returning void
  net: stmmac: dwmac-stm32: Convert to platform remove callback returning void
  net: stmmac: dwmac-sun8i: Convert to platform remove callback returning void
  net: stmmac: dwmac-tegra: Convert to platform remove callback returning void

 .../ethernet/stmicro/stmmac/dwmac-anarion.c   |  2 +-
 .../stmicro/stmmac/dwmac-dwc-qos-eth.c        |  6 ++----
 .../ethernet/stmicro/stmmac/dwmac-generic.c   |  2 +-
 .../net/ethernet/stmicro/stmmac/dwmac-imx.c   |  2 +-
 .../ethernet/stmicro/stmmac/dwmac-ingenic.c   |  2 +-
 .../stmicro/stmmac/dwmac-intel-plat.c         |  9 +++------
 .../ethernet/stmicro/stmmac/dwmac-ipq806x.c   |  2 +-
 .../ethernet/stmicro/stmmac/dwmac-lpc18xx.c   |  2 +-
 .../ethernet/stmicro/stmmac/dwmac-mediatek.c  |  9 +++------
 .../net/ethernet/stmicro/stmmac/dwmac-meson.c |  2 +-
 .../ethernet/stmicro/stmmac/dwmac-meson8b.c   |  2 +-
 .../net/ethernet/stmicro/stmmac/dwmac-oxnas.c |  2 +-
 .../stmicro/stmmac/dwmac-qcom-ethqos.c        | 15 ++++-----------
 .../net/ethernet/stmicro/stmmac/dwmac-rk.c    |  6 ++----
 .../ethernet/stmicro/stmmac/dwmac-socfpga.c   |  2 +-
 .../net/ethernet/stmicro/stmmac/dwmac-sti.c   |  6 ++----
 .../net/ethernet/stmicro/stmmac/dwmac-stm32.c |  6 ++----
 .../net/ethernet/stmicro/stmmac/dwmac-sun8i.c |  6 ++----
 .../net/ethernet/stmicro/stmmac/dwmac-sunxi.c |  2 +-
 .../net/ethernet/stmicro/stmmac/dwmac-tegra.c |  6 ++----
 .../ethernet/stmicro/stmmac/dwmac-visconti.c  | 19 +++++--------------
 .../ethernet/stmicro/stmmac/stmmac_platform.c |  4 +---
 .../ethernet/stmicro/stmmac/stmmac_platform.h |  2 +-
 23 files changed, 40 insertions(+), 76 deletions(-)

base-commit: fe15c26ee26efa11741a7b632e9f23b01aca4cc6
-- 
2.39.2


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

* [PATCH net-next 11/11] net: stmmac: dwmac-tegra: Convert to platform remove callback returning void
  2023-04-02 14:30 [PATCH net-next 00/11] net: stmmac: Convert to platform remove callback returning void Uwe Kleine-König
@ 2023-04-02 14:30 ` Uwe Kleine-König
  2023-04-03 15:54   ` Simon Horman
  2023-04-04 11:16   ` Thierry Reding
  0 siblings, 2 replies; 4+ messages in thread
From: Uwe Kleine-König @ 2023-04-02 14:30 UTC (permalink / raw)
  To: Giuseppe Cavallaro, Alexandre Torgue, Jose Abreu, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Maxime Coquelin,
	Thierry Reding, Jonathan Hunter
  Cc: netdev, linux-stm32, linux-arm-kernel, linux-tegra, 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 (mostly) ignored
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.

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/stmicro/stmmac/dwmac-tegra.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-tegra.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-tegra.c
index bdf990cf2f31..f8367c5b490b 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-tegra.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-tegra.c
@@ -353,15 +353,13 @@ static int tegra_mgbe_probe(struct platform_device *pdev)
 	return err;
 }
 
-static int tegra_mgbe_remove(struct platform_device *pdev)
+static void tegra_mgbe_remove(struct platform_device *pdev)
 {
 	struct tegra_mgbe *mgbe = get_stmmac_bsp_priv(&pdev->dev);
 
 	clk_bulk_disable_unprepare(ARRAY_SIZE(mgbe_clks), mgbe->clks);
 
 	stmmac_pltfr_remove(pdev);
-
-	return 0;
 }
 
 static const struct of_device_id tegra_mgbe_match[] = {
@@ -374,7 +372,7 @@ static SIMPLE_DEV_PM_OPS(tegra_mgbe_pm_ops, tegra_mgbe_suspend, tegra_mgbe_resum
 
 static struct platform_driver tegra_mgbe_driver = {
 	.probe = tegra_mgbe_probe,
-	.remove = tegra_mgbe_remove,
+	.remove_new = tegra_mgbe_remove,
 	.driver = {
 		.name = "tegra-mgbe",
 		.pm		= &tegra_mgbe_pm_ops,
-- 
2.39.2


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

* Re: [PATCH net-next 11/11] net: stmmac: dwmac-tegra: Convert to platform remove callback returning void
  2023-04-02 14:30 ` [PATCH net-next 11/11] net: stmmac: dwmac-tegra: " Uwe Kleine-König
@ 2023-04-03 15:54   ` Simon Horman
  2023-04-04 11:16   ` Thierry Reding
  1 sibling, 0 replies; 4+ messages in thread
From: Simon Horman @ 2023-04-03 15:54 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Giuseppe Cavallaro, Alexandre Torgue, Jose Abreu, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Maxime Coquelin,
	Thierry Reding, Jonathan Hunter, netdev, linux-stm32,
	linux-arm-kernel, linux-tegra, kernel

On Sun, Apr 02, 2023 at 04:30:25PM +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 (mostly) ignored
> 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.
> 
> 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: Simon Horman <simon.horman@corigine.com>


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

* Re: [PATCH net-next 11/11] net: stmmac: dwmac-tegra: Convert to platform remove callback returning void
  2023-04-02 14:30 ` [PATCH net-next 11/11] net: stmmac: dwmac-tegra: " Uwe Kleine-König
  2023-04-03 15:54   ` Simon Horman
@ 2023-04-04 11:16   ` Thierry Reding
  1 sibling, 0 replies; 4+ messages in thread
From: Thierry Reding @ 2023-04-04 11:16 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Giuseppe Cavallaro, Alexandre Torgue, Jose Abreu, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Maxime Coquelin,
	Jonathan Hunter, netdev, linux-stm32, linux-arm-kernel,
	linux-tegra, kernel

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

On Sun, Apr 02, 2023 at 04:30:25PM +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 (mostly) ignored
> 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.
> 
> 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/stmicro/stmmac/dwmac-tegra.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)

Acked-by: Thierry Reding <treding@nvidia.com>

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

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

end of thread, other threads:[~2023-04-04 11:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-02 14:30 [PATCH net-next 00/11] net: stmmac: Convert to platform remove callback returning void Uwe Kleine-König
2023-04-02 14:30 ` [PATCH net-next 11/11] net: stmmac: dwmac-tegra: " Uwe Kleine-König
2023-04-03 15:54   ` Simon Horman
2023-04-04 11:16   ` Thierry Reding

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox