Hello,
this series converts all platform drivers below drivers/mailbox that
make use of .remove() to use .remove_new() instead.
See commit 5c5a7680e67b ("platform: Provide a remove callback that
returns no value") for an extended explanation and the eventual goal.
The TL;DR; is to make it harder for driver authors to leak resources
without noticing. The drivers here get it right though and so can be
converted trivially.
This is merge window material. All patches are pairwise independent, so
they can be applied individually.
Best regards
Uwe
Uwe Kleine-König (12):
mailbox: bcm-flexrm: Convert to platform remove callback returning void
mailbox: bcm-pdc: Convert to platform remove callback returning void
mailbox: imx: Convert to platform remove callback returning void
mailbox: mailbox-test: Convert to platform remove callback returning void
mailbox: mtk-cmdq: Convert to platform remove callback returning void
mailbox: omap: Convert to platform remove callback returning void
mailbox: qcom-apcs-ipc: Convert to platform remove callback returning void
mailbox: qcom-ipcc: Convert to platform remove callback returning void
mailbox: stm32-ipcc: Convert to platform remove callback returning void
mailbox: sun6i-msgbox: Convert to platform remove callback returning void
mailbox: tegra-hsp: Convert to platform remove callback returning void
mailbox: zynqmp-ipi: Convert to platform remove callback returning void
drivers/mailbox/bcm-flexrm-mailbox.c | 6 ++----
drivers/mailbox/bcm-pdc-mailbox.c | 5 ++---
drivers/mailbox/imx-mailbox.c | 6 ++----
drivers/mailbox/mailbox-test.c | 6 ++----
drivers/mailbox/mtk-cmdq-mailbox.c | 5 ++---
drivers/mailbox/omap-mailbox.c | 6 ++----
drivers/mailbox/qcom-apcs-ipc-mailbox.c | 6 ++----
drivers/mailbox/qcom-ipcc.c | 6 ++----
drivers/mailbox/stm32-ipcc.c | 6 ++----
drivers/mailbox/sun6i-msgbox.c | 6 ++----
drivers/mailbox/tegra-hsp.c | 6 ++----
drivers/mailbox/zynqmp-ipi-mailbox.c | 6 ++----
12 files changed, 24 insertions(+), 46 deletions(-)
base-commit: 39676dfe52331dba909c617f213fdb21015c8d10
--
2.43.0
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]>
---
drivers/mailbox/stm32-ipcc.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/mailbox/stm32-ipcc.c b/drivers/mailbox/stm32-ipcc.c
index 4ad3653f3866..1442f275782b 100644
--- a/drivers/mailbox/stm32-ipcc.c
+++ b/drivers/mailbox/stm32-ipcc.c
@@ -331,7 +331,7 @@ static int stm32_ipcc_probe(struct platform_device *pdev)
return ret;
}
-static int stm32_ipcc_remove(struct platform_device *pdev)
+static void stm32_ipcc_remove(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
@@ -339,8 +339,6 @@ static int stm32_ipcc_remove(struct platform_device *pdev)
dev_pm_clear_wake_irq(&pdev->dev);
device_set_wakeup_capable(dev, false);
-
- return 0;
}
#ifdef CONFIG_PM_SLEEP
@@ -381,7 +379,7 @@ static struct platform_driver stm32_ipcc_driver = {
.of_match_table = stm32_ipcc_of_match,
},
.probe = stm32_ipcc_probe,
- .remove = stm32_ipcc_remove,
+ .remove_new = stm32_ipcc_remove,
};
module_platform_driver(stm32_ipcc_driver);
--
2.43.0