1 From b91ef50f70e7c092c50c1b92e63ef3fb0041cdd4 Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= <u.kleine-koenig@pengutronix.de>
3 Date: Mon, 18 Sep 2023 21:19:12 +0200
4 Subject: [PATCH 01/30] net: dsa: mt7530: Convert to platform remove callback
7 Content-Type: text/plain; charset=UTF-8
8 Content-Transfer-Encoding: 8bit
10 The .remove() callback for a platform driver returns an int which makes
11 many driver authors wrongly assume it's possible to do error handling by
12 returning an error code. However the value returned is ignored (apart
13 from emitting a warning) and this typically results in resource leaks.
14 To improve here there is a quest to make the remove callback return
15 void. In the first step of this quest all drivers are converted to
16 .remove_new() which already returns void. Eventually after all drivers
17 are converted, .remove_new() is renamed to .remove().
19 Trivially convert this driver from always returning zero in the remove
20 callback to the void returning variant.
22 Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
23 Reviewed-by: Andrew Lunn <andrew@lunn.ch>
24 Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
25 Acked-by: Daniel Golle <daniel@makrotopia.org>
26 Signed-off-by: David S. Miller <davem@davemloft.net>
28 drivers/net/dsa/mt7530-mmio.c | 7 ++-----
29 1 file changed, 2 insertions(+), 5 deletions(-)
31 --- a/drivers/net/dsa/mt7530-mmio.c
32 +++ b/drivers/net/dsa/mt7530-mmio.c
33 @@ -63,15 +63,12 @@ mt7988_probe(struct platform_device *pde
34 return dsa_register_switch(priv->ds);
38 -mt7988_remove(struct platform_device *pdev)
39 +static void mt7988_remove(struct platform_device *pdev)
41 struct mt7530_priv *priv = platform_get_drvdata(pdev);
44 mt7530_remove_common(priv);
49 static void mt7988_shutdown(struct platform_device *pdev)
50 @@ -88,7 +85,7 @@ static void mt7988_shutdown(struct platf
52 static struct platform_driver mt7988_platform_driver = {
53 .probe = mt7988_probe,
54 - .remove = mt7988_remove,
55 + .remove_new = mt7988_remove,
56 .shutdown = mt7988_shutdown,
58 .name = "mt7530-mmio",