Skip to content

Commit beb8592

Browse files
Uwe Kleine-Königdavem330
authored andcommitted
net: dsa: hirschmann: 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 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: Andrew Lunn <andrew@lunn.ch> Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com> Reviewed-by: Kurt Kanzenbach <kurt@linutronix.de> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 75f5205 commit beb8592

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

drivers/net/dsa/hirschmann/hellcreek.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2060,18 +2060,16 @@ static int hellcreek_probe(struct platform_device *pdev)
20602060
return ret;
20612061
}
20622062

2063-
static int hellcreek_remove(struct platform_device *pdev)
2063+
static void hellcreek_remove(struct platform_device *pdev)
20642064
{
20652065
struct hellcreek *hellcreek = platform_get_drvdata(pdev);
20662066

20672067
if (!hellcreek)
2068-
return 0;
2068+
return;
20692069

20702070
hellcreek_hwtstamp_free(hellcreek);
20712071
hellcreek_ptp_free(hellcreek);
20722072
dsa_unregister_switch(hellcreek->ds);
2073-
2074-
return 0;
20752073
}
20762074

20772075
static void hellcreek_shutdown(struct platform_device *pdev)
@@ -2107,7 +2105,7 @@ MODULE_DEVICE_TABLE(of, hellcreek_of_match);
21072105

21082106
static struct platform_driver hellcreek_driver = {
21092107
.probe = hellcreek_probe,
2110-
.remove = hellcreek_remove,
2108+
.remove_new = hellcreek_remove,
21112109
.shutdown = hellcreek_shutdown,
21122110
.driver = {
21132111
.name = "hellcreek",

0 commit comments

Comments
 (0)