* [PATCH 00/12] mailbox: Convert to platform remove callback returning void
@ 2023-12-27 21:02 Uwe Kleine-König
2023-12-27 21:02 ` [PATCH 01/12] mailbox: bcm-flexrm: " Uwe Kleine-König
` (11 more replies)
0 siblings, 12 replies; 15+ messages in thread
From: Uwe Kleine-König @ 2023-12-27 21:02 UTC (permalink / raw)
To: Jassi Brar
Cc: linux-kernel, Shawn Guo, Sascha Hauer, Fabio Estevam,
NXP Linux Team, linux-arm-kernel, Matthias Brugger,
AngeloGioacchino Del Regno, linux-mediatek, Bjorn Andersson,
Konrad Dybcio, linux-arm-msm, Manivannan Sadhasivam,
Maxime Coquelin, Alexandre Torgue, linux-stm32, Chen-Yu Tsai,
Jernej Skrabec, Samuel Holland, linux-sunxi, Thierry Reding,
Jonathan Hunter, linux-tegra, Michal Simek, kernel
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
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH 01/12] mailbox: bcm-flexrm: Convert to platform remove callback returning void
2023-12-27 21:02 [PATCH 00/12] mailbox: Convert to platform remove callback returning void Uwe Kleine-König
@ 2023-12-27 21:02 ` Uwe Kleine-König
2023-12-27 21:02 ` [PATCH 02/12] mailbox: bcm-pdc: " Uwe Kleine-König
` (10 subsequent siblings)
11 siblings, 0 replies; 15+ messages in thread
From: Uwe Kleine-König @ 2023-12-27 21:02 UTC (permalink / raw)
To: Jassi Brar; +Cc: linux-kernel, kernel
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>
---
drivers/mailbox/bcm-flexrm-mailbox.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/mailbox/bcm-flexrm-mailbox.c b/drivers/mailbox/bcm-flexrm-mailbox.c
index a2b8839d4e7c..e3e28a4f7d01 100644
--- a/drivers/mailbox/bcm-flexrm-mailbox.c
+++ b/drivers/mailbox/bcm-flexrm-mailbox.c
@@ -1650,7 +1650,7 @@ static int flexrm_mbox_probe(struct platform_device *pdev)
return ret;
}
-static int flexrm_mbox_remove(struct platform_device *pdev)
+static void flexrm_mbox_remove(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
struct flexrm_mbox *mbox = platform_get_drvdata(pdev);
@@ -1661,8 +1661,6 @@ static int flexrm_mbox_remove(struct platform_device *pdev)
dma_pool_destroy(mbox->cmpl_pool);
dma_pool_destroy(mbox->bd_pool);
-
- return 0;
}
static const struct of_device_id flexrm_mbox_of_match[] = {
@@ -1677,7 +1675,7 @@ static struct platform_driver flexrm_mbox_driver = {
.of_match_table = flexrm_mbox_of_match,
},
.probe = flexrm_mbox_probe,
- .remove = flexrm_mbox_remove,
+ .remove_new = flexrm_mbox_remove,
};
module_platform_driver(flexrm_mbox_driver);
--
2.43.0
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH 02/12] mailbox: bcm-pdc: Convert to platform remove callback returning void
2023-12-27 21:02 [PATCH 00/12] mailbox: Convert to platform remove callback returning void Uwe Kleine-König
2023-12-27 21:02 ` [PATCH 01/12] mailbox: bcm-flexrm: " Uwe Kleine-König
@ 2023-12-27 21:02 ` Uwe Kleine-König
2023-12-27 21:02 ` [PATCH 03/12] mailbox: imx: " Uwe Kleine-König
` (9 subsequent siblings)
11 siblings, 0 replies; 15+ messages in thread
From: Uwe Kleine-König @ 2023-12-27 21:02 UTC (permalink / raw)
To: Jassi Brar; +Cc: linux-kernel, kernel
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>
---
drivers/mailbox/bcm-pdc-mailbox.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/mailbox/bcm-pdc-mailbox.c b/drivers/mailbox/bcm-pdc-mailbox.c
index 778faeced81e..1768d3d5aaa0 100644
--- a/drivers/mailbox/bcm-pdc-mailbox.c
+++ b/drivers/mailbox/bcm-pdc-mailbox.c
@@ -1605,7 +1605,7 @@ static int pdc_probe(struct platform_device *pdev)
return err;
}
-static int pdc_remove(struct platform_device *pdev)
+static void pdc_remove(struct platform_device *pdev)
{
struct pdc_state *pdcs = platform_get_drvdata(pdev);
@@ -1617,12 +1617,11 @@ static int pdc_remove(struct platform_device *pdev)
dma_pool_destroy(pdcs->rx_buf_pool);
dma_pool_destroy(pdcs->ring_pool);
- return 0;
}
static struct platform_driver pdc_mbox_driver = {
.probe = pdc_probe,
- .remove = pdc_remove,
+ .remove_new = pdc_remove,
.driver = {
.name = "brcm-iproc-pdc-mbox",
.of_match_table = pdc_mbox_of_match,
--
2.43.0
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH 03/12] mailbox: imx: Convert to platform remove callback returning void
2023-12-27 21:02 [PATCH 00/12] mailbox: Convert to platform remove callback returning void Uwe Kleine-König
2023-12-27 21:02 ` [PATCH 01/12] mailbox: bcm-flexrm: " Uwe Kleine-König
2023-12-27 21:02 ` [PATCH 02/12] mailbox: bcm-pdc: " Uwe Kleine-König
@ 2023-12-27 21:02 ` Uwe Kleine-König
2023-12-27 21:02 ` [PATCH 04/12] mailbox: mailbox-test: " Uwe Kleine-König
` (8 subsequent siblings)
11 siblings, 0 replies; 15+ messages in thread
From: Uwe Kleine-König @ 2023-12-27 21:02 UTC (permalink / raw)
To: Jassi Brar
Cc: Shawn Guo, Sascha Hauer, Fabio Estevam, NXP Linux Team,
linux-kernel, linux-arm-kernel, kernel
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>
---
drivers/mailbox/imx-mailbox.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/mailbox/imx-mailbox.c b/drivers/mailbox/imx-mailbox.c
index 0af739ab571c..656171362fe9 100644
--- a/drivers/mailbox/imx-mailbox.c
+++ b/drivers/mailbox/imx-mailbox.c
@@ -903,13 +903,11 @@ static int imx_mu_probe(struct platform_device *pdev)
return ret;
}
-static int imx_mu_remove(struct platform_device *pdev)
+static void imx_mu_remove(struct platform_device *pdev)
{
struct imx_mu_priv *priv = platform_get_drvdata(pdev);
pm_runtime_disable(priv->dev);
-
- return 0;
}
static const struct imx_mu_dcfg imx_mu_cfg_imx6sx = {
@@ -1070,7 +1068,7 @@ static const struct dev_pm_ops imx_mu_pm_ops = {
static struct platform_driver imx_mu_driver = {
.probe = imx_mu_probe,
- .remove = imx_mu_remove,
+ .remove_new = imx_mu_remove,
.driver = {
.name = "imx_mu",
.of_match_table = imx_mu_dt_ids,
--
2.43.0
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH 04/12] mailbox: mailbox-test: Convert to platform remove callback returning void
2023-12-27 21:02 [PATCH 00/12] mailbox: Convert to platform remove callback returning void Uwe Kleine-König
` (2 preceding siblings ...)
2023-12-27 21:02 ` [PATCH 03/12] mailbox: imx: " Uwe Kleine-König
@ 2023-12-27 21:02 ` Uwe Kleine-König
2023-12-27 21:02 ` [PATCH 05/12] mailbox: mtk-cmdq: " Uwe Kleine-König
` (7 subsequent siblings)
11 siblings, 0 replies; 15+ messages in thread
From: Uwe Kleine-König @ 2023-12-27 21:02 UTC (permalink / raw)
To: Jassi Brar; +Cc: linux-kernel, kernel
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>
---
drivers/mailbox/mailbox-test.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/mailbox/mailbox-test.c b/drivers/mailbox/mailbox-test.c
index 22d6018ceec3..3386b4e72551 100644
--- a/drivers/mailbox/mailbox-test.c
+++ b/drivers/mailbox/mailbox-test.c
@@ -418,7 +418,7 @@ static int mbox_test_probe(struct platform_device *pdev)
return 0;
}
-static int mbox_test_remove(struct platform_device *pdev)
+static void mbox_test_remove(struct platform_device *pdev)
{
struct mbox_test_device *tdev = platform_get_drvdata(pdev);
@@ -428,8 +428,6 @@ static int mbox_test_remove(struct platform_device *pdev)
mbox_free_channel(tdev->tx_channel);
if (tdev->rx_channel)
mbox_free_channel(tdev->rx_channel);
-
- return 0;
}
static const struct of_device_id mbox_test_match[] = {
@@ -444,7 +442,7 @@ static struct platform_driver mbox_test_driver = {
.of_match_table = mbox_test_match,
},
.probe = mbox_test_probe,
- .remove = mbox_test_remove,
+ .remove_new = mbox_test_remove,
};
module_platform_driver(mbox_test_driver);
--
2.43.0
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH 05/12] mailbox: mtk-cmdq: Convert to platform remove callback returning void
2023-12-27 21:02 [PATCH 00/12] mailbox: Convert to platform remove callback returning void Uwe Kleine-König
` (3 preceding siblings ...)
2023-12-27 21:02 ` [PATCH 04/12] mailbox: mailbox-test: " Uwe Kleine-König
@ 2023-12-27 21:02 ` Uwe Kleine-König
2023-12-27 21:02 ` [PATCH 06/12] mailbox: omap: " Uwe Kleine-König
` (6 subsequent siblings)
11 siblings, 0 replies; 15+ messages in thread
From: Uwe Kleine-König @ 2023-12-27 21:02 UTC (permalink / raw)
To: Jassi Brar
Cc: Matthias Brugger, AngeloGioacchino Del Regno, linux-kernel,
linux-arm-kernel, linux-mediatek, kernel
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>
---
drivers/mailbox/mtk-cmdq-mailbox.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/mailbox/mtk-cmdq-mailbox.c b/drivers/mailbox/mtk-cmdq-mailbox.c
index de862e9137d5..c9009b729ab2 100644
--- a/drivers/mailbox/mtk-cmdq-mailbox.c
+++ b/drivers/mailbox/mtk-cmdq-mailbox.c
@@ -367,7 +367,7 @@ static int cmdq_resume(struct device *dev)
return 0;
}
-static int cmdq_remove(struct platform_device *pdev)
+static void cmdq_remove(struct platform_device *pdev)
{
struct cmdq *cmdq = platform_get_drvdata(pdev);
@@ -378,7 +378,6 @@ static int cmdq_remove(struct platform_device *pdev)
cmdq_runtime_suspend(&pdev->dev);
clk_bulk_unprepare(cmdq->pdata->gce_num, cmdq->clocks);
- return 0;
}
static int cmdq_mbox_send_data(struct mbox_chan *chan, void *data)
@@ -761,7 +760,7 @@ static const struct of_device_id cmdq_of_ids[] = {
static struct platform_driver cmdq_drv = {
.probe = cmdq_probe,
- .remove = cmdq_remove,
+ .remove_new = cmdq_remove,
.driver = {
.name = "mtk_cmdq",
.pm = &cmdq_pm_ops,
--
2.43.0
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH 06/12] mailbox: omap: Convert to platform remove callback returning void
2023-12-27 21:02 [PATCH 00/12] mailbox: Convert to platform remove callback returning void Uwe Kleine-König
` (4 preceding siblings ...)
2023-12-27 21:02 ` [PATCH 05/12] mailbox: mtk-cmdq: " Uwe Kleine-König
@ 2023-12-27 21:02 ` Uwe Kleine-König
2023-12-27 21:02 ` [PATCH 07/12] mailbox: qcom-apcs-ipc: " Uwe Kleine-König
` (5 subsequent siblings)
11 siblings, 0 replies; 15+ messages in thread
From: Uwe Kleine-König @ 2023-12-27 21:02 UTC (permalink / raw)
To: Jassi Brar; +Cc: linux-kernel, kernel
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>
---
drivers/mailbox/omap-mailbox.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/mailbox/omap-mailbox.c b/drivers/mailbox/omap-mailbox.c
index 792bcaebbc9b..c961706fe61d 100644
--- a/drivers/mailbox/omap-mailbox.c
+++ b/drivers/mailbox/omap-mailbox.c
@@ -865,19 +865,17 @@ static int omap_mbox_probe(struct platform_device *pdev)
return ret;
}
-static int omap_mbox_remove(struct platform_device *pdev)
+static void omap_mbox_remove(struct platform_device *pdev)
{
struct omap_mbox_device *mdev = platform_get_drvdata(pdev);
pm_runtime_disable(mdev->dev);
omap_mbox_unregister(mdev);
-
- return 0;
}
static struct platform_driver omap_mbox_driver = {
.probe = omap_mbox_probe,
- .remove = omap_mbox_remove,
+ .remove_new = omap_mbox_remove,
.driver = {
.name = "omap-mailbox",
.pm = &omap_mbox_pm_ops,
--
2.43.0
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH 07/12] mailbox: qcom-apcs-ipc: Convert to platform remove callback returning void
2023-12-27 21:02 [PATCH 00/12] mailbox: Convert to platform remove callback returning void Uwe Kleine-König
` (5 preceding siblings ...)
2023-12-27 21:02 ` [PATCH 06/12] mailbox: omap: " Uwe Kleine-König
@ 2023-12-27 21:02 ` Uwe Kleine-König
2023-12-27 21:02 ` [PATCH 08/12] mailbox: qcom-ipcc: " Uwe Kleine-König
` (4 subsequent siblings)
11 siblings, 0 replies; 15+ messages in thread
From: Uwe Kleine-König @ 2023-12-27 21:02 UTC (permalink / raw)
To: Jassi Brar
Cc: Bjorn Andersson, Konrad Dybcio, linux-arm-msm, linux-kernel, kernel
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>
---
drivers/mailbox/qcom-apcs-ipc-mailbox.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/mailbox/qcom-apcs-ipc-mailbox.c b/drivers/mailbox/qcom-apcs-ipc-mailbox.c
index 79136fb62f01..7d91e7c016ba 100644
--- a/drivers/mailbox/qcom-apcs-ipc-mailbox.c
+++ b/drivers/mailbox/qcom-apcs-ipc-mailbox.c
@@ -129,14 +129,12 @@ static int qcom_apcs_ipc_probe(struct platform_device *pdev)
return 0;
}
-static int qcom_apcs_ipc_remove(struct platform_device *pdev)
+static void qcom_apcs_ipc_remove(struct platform_device *pdev)
{
struct qcom_apcs_ipc *apcs = platform_get_drvdata(pdev);
struct platform_device *clk = apcs->clk;
platform_device_unregister(clk);
-
- return 0;
}
/* .data is the offset of the ipc register within the global block */
@@ -169,7 +167,7 @@ MODULE_DEVICE_TABLE(of, qcom_apcs_ipc_of_match);
static struct platform_driver qcom_apcs_ipc_driver = {
.probe = qcom_apcs_ipc_probe,
- .remove = qcom_apcs_ipc_remove,
+ .remove_new = qcom_apcs_ipc_remove,
.driver = {
.name = "qcom_apcs_ipc",
.of_match_table = qcom_apcs_ipc_of_match,
--
2.43.0
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH 08/12] mailbox: qcom-ipcc: Convert to platform remove callback returning void
2023-12-27 21:02 [PATCH 00/12] mailbox: Convert to platform remove callback returning void Uwe Kleine-König
` (6 preceding siblings ...)
2023-12-27 21:02 ` [PATCH 07/12] mailbox: qcom-apcs-ipc: " Uwe Kleine-König
@ 2023-12-27 21:02 ` Uwe Kleine-König
2023-12-27 21:02 ` [PATCH 09/12] mailbox: stm32-ipcc: " Uwe Kleine-König
` (3 subsequent siblings)
11 siblings, 0 replies; 15+ messages in thread
From: Uwe Kleine-König @ 2023-12-27 21:02 UTC (permalink / raw)
To: Jassi Brar
Cc: Bjorn Andersson, Konrad Dybcio, Manivannan Sadhasivam,
linux-arm-msm, linux-kernel, kernel
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>
---
drivers/mailbox/qcom-ipcc.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/mailbox/qcom-ipcc.c b/drivers/mailbox/qcom-ipcc.c
index f597a1bd5684..d537cc9c4d4b 100644
--- a/drivers/mailbox/qcom-ipcc.c
+++ b/drivers/mailbox/qcom-ipcc.c
@@ -326,14 +326,12 @@ static int qcom_ipcc_probe(struct platform_device *pdev)
return ret;
}
-static int qcom_ipcc_remove(struct platform_device *pdev)
+static void qcom_ipcc_remove(struct platform_device *pdev)
{
struct qcom_ipcc *ipcc = platform_get_drvdata(pdev);
disable_irq_wake(ipcc->irq);
irq_domain_remove(ipcc->irq_domain);
-
- return 0;
}
static const struct of_device_id qcom_ipcc_of_match[] = {
@@ -348,7 +346,7 @@ static const struct dev_pm_ops qcom_ipcc_dev_pm_ops = {
static struct platform_driver qcom_ipcc_driver = {
.probe = qcom_ipcc_probe,
- .remove = qcom_ipcc_remove,
+ .remove_new = qcom_ipcc_remove,
.driver = {
.name = "qcom-ipcc",
.of_match_table = qcom_ipcc_of_match,
--
2.43.0
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH 09/12] mailbox: stm32-ipcc: Convert to platform remove callback returning void
2023-12-27 21:02 [PATCH 00/12] mailbox: Convert to platform remove callback returning void Uwe Kleine-König
` (7 preceding siblings ...)
2023-12-27 21:02 ` [PATCH 08/12] mailbox: qcom-ipcc: " Uwe Kleine-König
@ 2023-12-27 21:02 ` Uwe Kleine-König
2023-12-27 21:02 ` [PATCH 10/12] mailbox: sun6i-msgbox: " Uwe Kleine-König
` (2 subsequent siblings)
11 siblings, 0 replies; 15+ messages in thread
From: Uwe Kleine-König @ 2023-12-27 21:02 UTC (permalink / raw)
To: Jassi Brar
Cc: Maxime Coquelin, Alexandre Torgue, linux-kernel, linux-stm32,
linux-arm-kernel, kernel
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>
---
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
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH 10/12] mailbox: sun6i-msgbox: Convert to platform remove callback returning void
2023-12-27 21:02 [PATCH 00/12] mailbox: Convert to platform remove callback returning void Uwe Kleine-König
` (8 preceding siblings ...)
2023-12-27 21:02 ` [PATCH 09/12] mailbox: stm32-ipcc: " Uwe Kleine-König
@ 2023-12-27 21:02 ` Uwe Kleine-König
2024-01-09 20:15 ` Jernej Škrabec
2023-12-27 21:02 ` [PATCH 11/12] mailbox: tegra-hsp: " Uwe Kleine-König
2023-12-27 21:02 ` [PATCH 12/12] mailbox: zynqmp-ipi: " Uwe Kleine-König
11 siblings, 1 reply; 15+ messages in thread
From: Uwe Kleine-König @ 2023-12-27 21:02 UTC (permalink / raw)
To: Jassi Brar
Cc: Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, linux-kernel,
linux-arm-kernel, linux-sunxi, kernel
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>
---
drivers/mailbox/sun6i-msgbox.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/mailbox/sun6i-msgbox.c b/drivers/mailbox/sun6i-msgbox.c
index 7f8d931042d3..3dcc54dc83b2 100644
--- a/drivers/mailbox/sun6i-msgbox.c
+++ b/drivers/mailbox/sun6i-msgbox.c
@@ -287,15 +287,13 @@ static int sun6i_msgbox_probe(struct platform_device *pdev)
return ret;
}
-static int sun6i_msgbox_remove(struct platform_device *pdev)
+static void sun6i_msgbox_remove(struct platform_device *pdev)
{
struct sun6i_msgbox *mbox = platform_get_drvdata(pdev);
mbox_controller_unregister(&mbox->controller);
/* See the comment in sun6i_msgbox_probe about the reset line. */
clk_disable_unprepare(mbox->clk);
-
- return 0;
}
static const struct of_device_id sun6i_msgbox_of_match[] = {
@@ -310,7 +308,7 @@ static struct platform_driver sun6i_msgbox_driver = {
.of_match_table = sun6i_msgbox_of_match,
},
.probe = sun6i_msgbox_probe,
- .remove = sun6i_msgbox_remove,
+ .remove_new = sun6i_msgbox_remove,
};
module_platform_driver(sun6i_msgbox_driver);
--
2.43.0
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH 11/12] mailbox: tegra-hsp: Convert to platform remove callback returning void
2023-12-27 21:02 [PATCH 00/12] mailbox: Convert to platform remove callback returning void Uwe Kleine-König
` (9 preceding siblings ...)
2023-12-27 21:02 ` [PATCH 10/12] mailbox: sun6i-msgbox: " Uwe Kleine-König
@ 2023-12-27 21:02 ` Uwe Kleine-König
2023-12-27 21:02 ` [PATCH 12/12] mailbox: zynqmp-ipi: " Uwe Kleine-König
11 siblings, 0 replies; 15+ messages in thread
From: Uwe Kleine-König @ 2023-12-27 21:02 UTC (permalink / raw)
To: Jassi Brar
Cc: Thierry Reding, Jonathan Hunter, linux-kernel, linux-tegra, kernel
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>
---
drivers/mailbox/tegra-hsp.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/mailbox/tegra-hsp.c b/drivers/mailbox/tegra-hsp.c
index fe29fc2ca526..19ef56cbcfd3 100644
--- a/drivers/mailbox/tegra-hsp.c
+++ b/drivers/mailbox/tegra-hsp.c
@@ -868,13 +868,11 @@ static int tegra_hsp_probe(struct platform_device *pdev)
return 0;
}
-static int tegra_hsp_remove(struct platform_device *pdev)
+static void tegra_hsp_remove(struct platform_device *pdev)
{
struct tegra_hsp *hsp = platform_get_drvdata(pdev);
lockdep_unregister_key(&hsp->lock_key);
-
- return 0;
}
static int __maybe_unused tegra_hsp_resume(struct device *dev)
@@ -953,7 +951,7 @@ static struct platform_driver tegra_hsp_driver = {
.pm = &tegra_hsp_pm_ops,
},
.probe = tegra_hsp_probe,
- .remove = tegra_hsp_remove,
+ .remove_new = tegra_hsp_remove,
};
static int __init tegra_hsp_init(void)
--
2.43.0
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH 12/12] mailbox: zynqmp-ipi: Convert to platform remove callback returning void
2023-12-27 21:02 [PATCH 00/12] mailbox: Convert to platform remove callback returning void Uwe Kleine-König
` (10 preceding siblings ...)
2023-12-27 21:02 ` [PATCH 11/12] mailbox: tegra-hsp: " Uwe Kleine-König
@ 2023-12-27 21:02 ` Uwe Kleine-König
2024-01-02 9:36 ` Michal Simek
11 siblings, 1 reply; 15+ messages in thread
From: Uwe Kleine-König @ 2023-12-27 21:02 UTC (permalink / raw)
To: Jassi Brar; +Cc: Michal Simek, linux-kernel, linux-arm-kernel, kernel
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>
---
drivers/mailbox/zynqmp-ipi-mailbox.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/mailbox/zynqmp-ipi-mailbox.c b/drivers/mailbox/zynqmp-ipi-mailbox.c
index 7fa533e80dd9..610a92f9c0b2 100644
--- a/drivers/mailbox/zynqmp-ipi-mailbox.c
+++ b/drivers/mailbox/zynqmp-ipi-mailbox.c
@@ -688,19 +688,17 @@ static int zynqmp_ipi_probe(struct platform_device *pdev)
return ret;
}
-static int zynqmp_ipi_remove(struct platform_device *pdev)
+static void zynqmp_ipi_remove(struct platform_device *pdev)
{
struct zynqmp_ipi_pdata *pdata;
pdata = platform_get_drvdata(pdev);
zynqmp_ipi_free_mboxes(pdata);
-
- return 0;
}
static struct platform_driver zynqmp_ipi_driver = {
.probe = zynqmp_ipi_probe,
- .remove = zynqmp_ipi_remove,
+ .remove_new = zynqmp_ipi_remove,
.driver = {
.name = "zynqmp-ipi",
.of_match_table = of_match_ptr(zynqmp_ipi_of_match),
--
2.43.0
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 12/12] mailbox: zynqmp-ipi: Convert to platform remove callback returning void
2023-12-27 21:02 ` [PATCH 12/12] mailbox: zynqmp-ipi: " Uwe Kleine-König
@ 2024-01-02 9:36 ` Michal Simek
0 siblings, 0 replies; 15+ messages in thread
From: Michal Simek @ 2024-01-02 9:36 UTC (permalink / raw)
To: Uwe Kleine-König, Jassi Brar; +Cc: linux-kernel, linux-arm-kernel, kernel
On 12/27/23 22:02, Uwe Kleine-König wrote:
> 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>
> ---
> drivers/mailbox/zynqmp-ipi-mailbox.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/mailbox/zynqmp-ipi-mailbox.c b/drivers/mailbox/zynqmp-ipi-mailbox.c
> index 7fa533e80dd9..610a92f9c0b2 100644
> --- a/drivers/mailbox/zynqmp-ipi-mailbox.c
> +++ b/drivers/mailbox/zynqmp-ipi-mailbox.c
> @@ -688,19 +688,17 @@ static int zynqmp_ipi_probe(struct platform_device *pdev)
> return ret;
> }
>
> -static int zynqmp_ipi_remove(struct platform_device *pdev)
> +static void zynqmp_ipi_remove(struct platform_device *pdev)
> {
> struct zynqmp_ipi_pdata *pdata;
>
> pdata = platform_get_drvdata(pdev);
> zynqmp_ipi_free_mboxes(pdata);
> -
> - return 0;
> }
>
> static struct platform_driver zynqmp_ipi_driver = {
> .probe = zynqmp_ipi_probe,
> - .remove = zynqmp_ipi_remove,
> + .remove_new = zynqmp_ipi_remove,
> .driver = {
> .name = "zynqmp-ipi",
> .of_match_table = of_match_ptr(zynqmp_ipi_of_match),
Reviewed-by: Michal Simek <michal.simek@amd.com>
Thanks,
Michal
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 10/12] mailbox: sun6i-msgbox: Convert to platform remove callback returning void
2023-12-27 21:02 ` [PATCH 10/12] mailbox: sun6i-msgbox: " Uwe Kleine-König
@ 2024-01-09 20:15 ` Jernej Škrabec
0 siblings, 0 replies; 15+ messages in thread
From: Jernej Škrabec @ 2024-01-09 20:15 UTC (permalink / raw)
To: Jassi Brar, Uwe Kleine-König
Cc: Chen-Yu Tsai, Samuel Holland, linux-kernel, linux-arm-kernel,
linux-sunxi, kernel
Dne sreda, 27. december 2023 ob 22:02:38 CET je Uwe Kleine-König napisal(a):
> 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>
Acked-by: Jernej Skrabec <jernej.skrabec@gmail.com>
Best regards,
Jernej
^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2024-01-09 20:15 UTC | newest]
Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-27 21:02 [PATCH 00/12] mailbox: Convert to platform remove callback returning void Uwe Kleine-König
2023-12-27 21:02 ` [PATCH 01/12] mailbox: bcm-flexrm: " Uwe Kleine-König
2023-12-27 21:02 ` [PATCH 02/12] mailbox: bcm-pdc: " Uwe Kleine-König
2023-12-27 21:02 ` [PATCH 03/12] mailbox: imx: " Uwe Kleine-König
2023-12-27 21:02 ` [PATCH 04/12] mailbox: mailbox-test: " Uwe Kleine-König
2023-12-27 21:02 ` [PATCH 05/12] mailbox: mtk-cmdq: " Uwe Kleine-König
2023-12-27 21:02 ` [PATCH 06/12] mailbox: omap: " Uwe Kleine-König
2023-12-27 21:02 ` [PATCH 07/12] mailbox: qcom-apcs-ipc: " Uwe Kleine-König
2023-12-27 21:02 ` [PATCH 08/12] mailbox: qcom-ipcc: " Uwe Kleine-König
2023-12-27 21:02 ` [PATCH 09/12] mailbox: stm32-ipcc: " Uwe Kleine-König
2023-12-27 21:02 ` [PATCH 10/12] mailbox: sun6i-msgbox: " Uwe Kleine-König
2024-01-09 20:15 ` Jernej Škrabec
2023-12-27 21:02 ` [PATCH 11/12] mailbox: tegra-hsp: " Uwe Kleine-König
2023-12-27 21:02 ` [PATCH 12/12] mailbox: zynqmp-ipi: " Uwe Kleine-König
2024-01-02 9:36 ` Michal Simek
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®