Skip to content

Commit 3f35533

Browse files
Uwe Kleine-Königandreas-gaisler
authored andcommitted
sbus: display7seg: 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/dc10c77a6ababab6ffdb344982e8a04cc337bdc7.1709591118.git.u.kleine-koenig@pengutronix.de
1 parent d0e7177 commit 3f35533

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

drivers/sbus/char/display7seg.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ static int d7s_probe(struct platform_device *op)
229229
goto out;
230230
}
231231

232-
static int d7s_remove(struct platform_device *op)
232+
static void d7s_remove(struct platform_device *op)
233233
{
234234
struct d7s *p = dev_get_drvdata(&op->dev);
235235
u8 regs = readb(p->regs);
@@ -245,8 +245,6 @@ static int d7s_remove(struct platform_device *op)
245245

246246
misc_deregister(&d7s_miscdev);
247247
of_iounmap(&op->resource[0], p->regs, sizeof(u8));
248-
249-
return 0;
250248
}
251249

252250
static const struct of_device_id d7s_match[] = {
@@ -263,7 +261,7 @@ static struct platform_driver d7s_driver = {
263261
.of_match_table = d7s_match,
264262
},
265263
.probe = d7s_probe,
266-
.remove = d7s_remove,
264+
.remove_new = d7s_remove,
267265
};
268266

269267
module_platform_driver(d7s_driver);

0 commit comments

Comments
 (0)