ffcf51dab5eaaa83b7cae2fa303c7f50ae3f6c4c
[openwrt/staging/pepe2k.git] /
1 From 03ede98ecc29b59fb364f735d6de0e6a4c1735fc 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 18/48] net: dsa: mt7530: Convert to platform remove callback
5 returning void
6 MIME-Version: 1.0
7 Content-Type: text/plain; charset=UTF-8
8 Content-Transfer-Encoding: 8bit
9
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().
18
19 Trivially convert this driver from always returning zero in the remove
20 callback to the void returning variant.
21
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>
27 ---
28 drivers/net/dsa/mt7530-mmio.c | 7 ++-----
29 1 file changed, 2 insertions(+), 5 deletions(-)
30
31 --- a/drivers/net/dsa/mt7530-mmio.c
32 +++ b/drivers/net/dsa/mt7530-mmio.c
33 @@ -62,15 +62,12 @@ mt7988_probe(struct platform_device *pde
34 return dsa_register_switch(priv->ds);
35 }
36
37 -static int
38 -mt7988_remove(struct platform_device *pdev)
39 +static void mt7988_remove(struct platform_device *pdev)
40 {
41 struct mt7530_priv *priv = platform_get_drvdata(pdev);
42
43 if (priv)
44 mt7530_remove_common(priv);
45 -
46 - return 0;
47 }
48
49 static void mt7988_shutdown(struct platform_device *pdev)
50 @@ -87,7 +84,7 @@ static void mt7988_shutdown(struct platf
51
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,
57 .driver = {
58 .name = "mt7530-mmio",