Skip to content

Commit 09c531e

Browse files
Uwe Kleine-Königandreas-gaisler
authored andcommitted
sbus: envctrl: 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() will be 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: Andreas Larsson <andreas@gaisler.com> Signed-off-by: Andreas Larsson <andreas@gaisler.com> Link: https://lore.kernel.org/r/0b61ed6fb4ebe2880951b1e849551dbc63402802.1709591118.git.u.kleine-koenig@pengutronix.de
1 parent 3f35533 commit 09c531e

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

drivers/sbus/char/envctrl.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1097,7 +1097,7 @@ static int envctrl_probe(struct platform_device *op)
10971097
return err;
10981098
}
10991099

1100-
static int envctrl_remove(struct platform_device *op)
1100+
static void envctrl_remove(struct platform_device *op)
11011101
{
11021102
int index;
11031103

@@ -1108,8 +1108,6 @@ static int envctrl_remove(struct platform_device *op)
11081108

11091109
for (index = 0; index < ENVCTRL_MAX_CPU * 2; index++)
11101110
kfree(i2c_childlist[index].tables);
1111-
1112-
return 0;
11131111
}
11141112

11151113
static const struct of_device_id envctrl_match[] = {
@@ -1127,7 +1125,7 @@ static struct platform_driver envctrl_driver = {
11271125
.of_match_table = envctrl_match,
11281126
},
11291127
.probe = envctrl_probe,
1130-
.remove = envctrl_remove,
1128+
.remove_new = envctrl_remove,
11311129
};
11321130

11331131
module_platform_driver(envctrl_driver);

0 commit comments

Comments
 (0)