Skip to content

Commit b6c1fea

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

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

drivers/platform/chrome/cros_usbpd_logger.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -219,14 +219,12 @@ static int cros_usbpd_logger_probe(struct platform_device *pd)
219219
return 0;
220220
}
221221

222-
static int cros_usbpd_logger_remove(struct platform_device *pd)
222+
static void cros_usbpd_logger_remove(struct platform_device *pd)
223223
{
224224
struct logger_data *logger = platform_get_drvdata(pd);
225225

226226
cancel_delayed_work_sync(&logger->log_work);
227227
destroy_workqueue(logger->log_workqueue);
228-
229-
return 0;
230228
}
231229

232230
static int __maybe_unused cros_usbpd_logger_resume(struct device *dev)
@@ -257,7 +255,7 @@ static struct platform_driver cros_usbpd_logger_driver = {
257255
.pm = &cros_usbpd_logger_pm_ops,
258256
},
259257
.probe = cros_usbpd_logger_probe,
260-
.remove = cros_usbpd_logger_remove,
258+
.remove_new = cros_usbpd_logger_remove,
261259
};
262260

263261
module_platform_driver(cros_usbpd_logger_driver);

0 commit comments

Comments
 (0)