Skip to content

Commit 31fd8f1

Browse files
Uwe Kleine-Königgregkh
authored andcommitted
firmware: turris-mox-rwtm: 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: Marek Behún <kabel@kernel.org> Link: https://lore.kernel.org/r/9074d1ad2e889425991fecad664781ae27b2418a.1703693980.git.u.kleine-koenig@pengutronix.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 51e24ba commit 31fd8f1

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

drivers/firmware/turris-mox-rwtm.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -554,16 +554,14 @@ static int turris_mox_rwtm_probe(struct platform_device *pdev)
554554
return ret;
555555
}
556556

557-
static int turris_mox_rwtm_remove(struct platform_device *pdev)
557+
static void turris_mox_rwtm_remove(struct platform_device *pdev)
558558
{
559559
struct mox_rwtm *rwtm = platform_get_drvdata(pdev);
560560

561561
rwtm_unregister_debugfs(rwtm);
562562
sysfs_remove_files(rwtm_to_kobj(rwtm), mox_rwtm_attrs);
563563
kobject_put(rwtm_to_kobj(rwtm));
564564
mbox_free_channel(rwtm->mbox);
565-
566-
return 0;
567565
}
568566

569567
static const struct of_device_id turris_mox_rwtm_match[] = {
@@ -576,7 +574,7 @@ MODULE_DEVICE_TABLE(of, turris_mox_rwtm_match);
576574

577575
static struct platform_driver turris_mox_rwtm_driver = {
578576
.probe = turris_mox_rwtm_probe,
579-
.remove = turris_mox_rwtm_remove,
577+
.remove_new = turris_mox_rwtm_remove,
580578
.driver = {
581579
.name = DRIVER_NAME,
582580
.of_match_table = turris_mox_rwtm_match,

0 commit comments

Comments
 (0)