Skip to content

Commit e02944e

Browse files
Uwe Kleine-KönigTzung-Bi Shih
authored andcommitted
platform/chrome: cros_ec_lpc: 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 fa45583 commit e02944e

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

drivers/platform/chrome/cros_ec_lpc.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,7 @@ static int cros_ec_lpc_probe(struct platform_device *pdev)
460460
return 0;
461461
}
462462

463-
static int cros_ec_lpc_remove(struct platform_device *pdev)
463+
static void cros_ec_lpc_remove(struct platform_device *pdev)
464464
{
465465
struct cros_ec_device *ec_dev = platform_get_drvdata(pdev);
466466
struct acpi_device *adev;
@@ -471,8 +471,6 @@ static int cros_ec_lpc_remove(struct platform_device *pdev)
471471
cros_ec_lpc_acpi_notify);
472472

473473
cros_ec_unregister(ec_dev);
474-
475-
return 0;
476474
}
477475

478476
static const struct acpi_device_id cros_ec_lpc_acpi_device_ids[] = {
@@ -580,7 +578,7 @@ static struct platform_driver cros_ec_lpc_driver = {
580578
.probe_type = PROBE_FORCE_SYNCHRONOUS,
581579
},
582580
.probe = cros_ec_lpc_probe,
583-
.remove = cros_ec_lpc_remove,
581+
.remove_new = cros_ec_lpc_remove,
584582
};
585583

586584
static struct platform_device cros_ec_lpc_device = {

0 commit comments

Comments
 (0)