Skip to content

Commit d030061

Browse files
Uwe Kleine-KönigJiri Kosina
authored andcommitted
HID: google: hammer: 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]> Signed-off-by: Jiri Kosina <[email protected]>
1 parent 3e78a6c commit d030061

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

drivers/hid/hid-google-hammer.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ static int cbas_ec_probe(struct platform_device *pdev)
255255
return retval;
256256
}
257257

258-
static int cbas_ec_remove(struct platform_device *pdev)
258+
static void cbas_ec_remove(struct platform_device *pdev)
259259
{
260260
struct cros_ec_device *ec = dev_get_drvdata(pdev->dev.parent);
261261

@@ -266,7 +266,6 @@ static int cbas_ec_remove(struct platform_device *pdev)
266266
cbas_ec_set_input(NULL);
267267

268268
mutex_unlock(&cbas_ec_reglock);
269-
return 0;
270269
}
271270

272271
static const struct acpi_device_id cbas_ec_acpi_ids[] = {
@@ -285,7 +284,7 @@ MODULE_DEVICE_TABLE(of, cbas_ec_of_match);
285284

286285
static struct platform_driver cbas_ec_driver = {
287286
.probe = cbas_ec_probe,
288-
.remove = cbas_ec_remove,
287+
.remove_new = cbas_ec_remove,
289288
.driver = {
290289
.name = "cbas_ec",
291290
.acpi_match_table = ACPI_PTR(cbas_ec_acpi_ids),

0 commit comments

Comments
 (0)