Skip to content

Commit fa45583

Browse files
Uwe Kleine-KönigTzung-Bi Shih
authored andcommitted
platform/chrome: cros_ec_lightbar: 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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Tzung-Bi Shih <[email protected]>
1 parent f366fa0 commit fa45583

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

drivers/platform/chrome/cros_ec_lightbar.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -560,7 +560,7 @@ static int cros_ec_lightbar_probe(struct platform_device *pd)
560560
return ret;
561561
}
562562

563-
static int cros_ec_lightbar_remove(struct platform_device *pd)
563+
static void cros_ec_lightbar_remove(struct platform_device *pd)
564564
{
565565
struct cros_ec_dev *ec_dev = dev_get_drvdata(pd->dev.parent);
566566

@@ -569,8 +569,6 @@ static int cros_ec_lightbar_remove(struct platform_device *pd)
569569

570570
/* Let the EC take over the lightbar again. */
571571
lb_manual_suspend_ctrl(ec_dev, 0);
572-
573-
return 0;
574572
}
575573

576574
static int __maybe_unused cros_ec_lightbar_resume(struct device *dev)
@@ -603,7 +601,7 @@ static struct platform_driver cros_ec_lightbar_driver = {
603601
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
604602
},
605603
.probe = cros_ec_lightbar_probe,
606-
.remove = cros_ec_lightbar_remove,
604+
.remove_new = cros_ec_lightbar_remove,
607605
};
608606

609607
module_platform_driver(cros_ec_lightbar_driver);

0 commit comments

Comments
 (0)