Skip to content

Commit 4864850

Browse files
Uwe Kleine-KönigTzung-Bi Shih
authored andcommitted
platform/chrome/wilco_ec: core: 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 b98362b commit 4864850

File tree

1 file changed

+2
-3
lines changed
  • drivers/platform/chrome/wilco_ec

1 file changed

+2
-3
lines changed

drivers/platform/chrome/wilco_ec/core.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ static int wilco_ec_probe(struct platform_device *pdev)
132132
return ret;
133133
}
134134

135-
static int wilco_ec_remove(struct platform_device *pdev)
135+
static void wilco_ec_remove(struct platform_device *pdev)
136136
{
137137
struct wilco_ec_device *ec = platform_get_drvdata(pdev);
138138

@@ -142,7 +142,6 @@ static int wilco_ec_remove(struct platform_device *pdev)
142142
platform_device_unregister(ec->rtc_pdev);
143143
if (ec->debugfs_pdev)
144144
platform_device_unregister(ec->debugfs_pdev);
145-
return 0;
146145
}
147146

148147
static const struct acpi_device_id wilco_ec_acpi_device_ids[] = {
@@ -157,7 +156,7 @@ static struct platform_driver wilco_ec_driver = {
157156
.acpi_match_table = wilco_ec_acpi_device_ids,
158157
},
159158
.probe = wilco_ec_probe,
160-
.remove = wilco_ec_remove,
159+
.remove_new = wilco_ec_remove,
161160
};
162161

163162
module_platform_driver(wilco_ec_driver);

0 commit comments

Comments
 (0)