Skip to content

Commit f04410e

Browse files
Uwe Kleine-KönigTzung-Bi Shih
authored andcommitted
platform/chrome: cros_ec_chardev: 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 1aa8df9 commit f04410e

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

drivers/platform/chrome/cros_ec_chardev.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -396,21 +396,19 @@ static int cros_ec_chardev_probe(struct platform_device *pdev)
396396
return misc_register(&data->misc);
397397
}
398398

399-
static int cros_ec_chardev_remove(struct platform_device *pdev)
399+
static void cros_ec_chardev_remove(struct platform_device *pdev)
400400
{
401401
struct chardev_data *data = dev_get_drvdata(&pdev->dev);
402402

403403
misc_deregister(&data->misc);
404-
405-
return 0;
406404
}
407405

408406
static struct platform_driver cros_ec_chardev_driver = {
409407
.driver = {
410408
.name = DRV_NAME,
411409
},
412410
.probe = cros_ec_chardev_probe,
413-
.remove = cros_ec_chardev_remove,
411+
.remove_new = cros_ec_chardev_remove,
414412
};
415413

416414
module_platform_driver(cros_ec_chardev_driver);

0 commit comments

Comments
 (0)