Skip to content

Commit 7396a5b

Browse files
Uwe Kleine-KönigTzung-Bi Shih
authored andcommitted
platform/chrome/wilco_ec: telemetry: 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 1fca58f commit 7396a5b

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

drivers/platform/chrome/wilco_ec/telemetry.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -400,20 +400,18 @@ static int telem_device_probe(struct platform_device *pdev)
400400
return 0;
401401
}
402402

403-
static int telem_device_remove(struct platform_device *pdev)
403+
static void telem_device_remove(struct platform_device *pdev)
404404
{
405405
struct telem_device_data *dev_data = platform_get_drvdata(pdev);
406406

407407
cdev_device_del(&dev_data->cdev, &dev_data->dev);
408408
ida_simple_remove(&telem_ida, MINOR(dev_data->dev.devt));
409409
put_device(&dev_data->dev);
410-
411-
return 0;
412410
}
413411

414412
static struct platform_driver telem_driver = {
415413
.probe = telem_device_probe,
416-
.remove = telem_device_remove,
414+
.remove_new = telem_device_remove,
417415
.driver = {
418416
.name = DRV_NAME,
419417
},

0 commit comments

Comments
 (0)