Skip to content

Commit f1013d8

Browse files
Uwe Kleine-Königmichalsimek
authored andcommitted
soc/xilinx: zynqmp_power: 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 <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/20230925095532.1984344-41-u.kleine-koenig@pengutronix.de Signed-off-by: Michal Simek <michal.simek@amd.com>
1 parent b85ea95 commit f1013d8

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

drivers/soc/xilinx/zynqmp_power.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -275,16 +275,14 @@ static int zynqmp_pm_probe(struct platform_device *pdev)
275275
return 0;
276276
}
277277

278-
static int zynqmp_pm_remove(struct platform_device *pdev)
278+
static void zynqmp_pm_remove(struct platform_device *pdev)
279279
{
280280
sysfs_remove_file(&pdev->dev.kobj, &dev_attr_suspend_mode.attr);
281281
if (event_registered)
282282
xlnx_unregister_event(PM_INIT_SUSPEND_CB, 0, 0, suspend_event_callback, NULL);
283283

284284
if (!rx_chan)
285285
mbox_free_channel(rx_chan);
286-
287-
return 0;
288286
}
289287

290288
static const struct of_device_id pm_of_match[] = {
@@ -295,7 +293,7 @@ MODULE_DEVICE_TABLE(of, pm_of_match);
295293

296294
static struct platform_driver zynqmp_pm_platform_driver = {
297295
.probe = zynqmp_pm_probe,
298-
.remove = zynqmp_pm_remove,
296+
.remove_new = zynqmp_pm_remove,
299297
.driver = {
300298
.name = "zynqmp_power",
301299
.of_match_table = pm_of_match,

0 commit comments

Comments
 (0)