* [PATCH 00/11] firmware: Convert to platform remove callback returning void
@ 2023-12-27 16:26 Uwe Kleine-König
2023-12-27 16:26 ` [PATCH 01/11] firmware: arm_scmi: " Uwe Kleine-König
` (5 more replies)
0 siblings, 6 replies; 9+ messages in thread
From: Uwe Kleine-König @ 2023-12-27 16:26 UTC (permalink / raw)
To: Sudeep Holla, Tzung-Bi Shih, Shawn Guo, Sascha Hauer,
Daniel Baluta, Thierry Reding, Hao Ge, Rob Herring,
Christophe JAILLET, Matthias Brugger, AngeloGioacchino Del Regno,
Arnd Bergmann, Gabriel Somlo, Michael S. Tsirkin,
Florian Fainelli, Kieran Bingham, Dinh Nguyen, Marek Behún,
Michal Simek, Greg Kroah-Hartman, Jay Buddhabhatti,
Sai Krishna Potthuri, Linus Walleij, Nava kishore Manne,
Rajan Vaja, Dhaval Shah, Marek Vasut
Cc: kernel, Cristian Marussi, linux-arm-kernel, linux-kernel,
Brian Norris, Julius Werner, chrome-platform, Fabio Estevam,
NXP Linux Team, linux-mediatek, qemu-devel,
Broadcom internal kernel review list, linux-rpi-kernel
Hello,
this series converts all platform drivers below drivers/firmware 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. There doesn't seem to be a maintainer for
all of drivers/firmware and I don't know how patch application works
there usually. All patches are pairwise independent, so they can be
applied individually.
Best regards
Uwe
Uwe Kleine-König (11):
firmware: arm_scmi: Convert to platform remove callback returning void
firmware: arm_scpi: Convert to platform remove callback returning void
firmware: coreboot_table: Convert to platform remove callback returning void
firmware: imx-dsp: Convert to platform remove callback returning void
firmware: mtk-adsp-ipc: Convert to platform remove callback returning void
firmware: qemu_fw_cfg: Convert to platform remove callback returning void
firmware: raspberrypi: Convert to platform remove callback returning void
firmware: stratix10-rsu: Convert to platform remove callback returning void
firmware: stratix10-svc: Convert to platform remove callback returning void
firmware: turris-mox-rwtm: Convert to platform remove callback returning void
firmware: zynqmp: Convert to platform remove callback returning void
drivers/firmware/arm_scmi/driver.c | 6 ++----
drivers/firmware/arm_scpi.c | 6 ++----
drivers/firmware/google/coreboot_table.c | 5 ++---
drivers/firmware/imx/imx-dsp.c | 6 ++----
drivers/firmware/mtk-adsp-ipc.c | 6 ++----
drivers/firmware/qemu_fw_cfg.c | 5 ++---
drivers/firmware/raspberrypi.c | 6 ++----
drivers/firmware/stratix10-rsu.c | 5 ++---
drivers/firmware/stratix10-svc.c | 6 ++----
drivers/firmware/turris-mox-rwtm.c | 6 ++----
drivers/firmware/xilinx/zynqmp.c | 6 ++----
11 files changed, 22 insertions(+), 41 deletions(-)
base-commit: 39676dfe52331dba909c617f213fdb21015c8d10
--
2.43.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 01/11] firmware: arm_scmi: Convert to platform remove callback returning void
2023-12-27 16:26 [PATCH 00/11] firmware: Convert to platform remove callback returning void Uwe Kleine-König
@ 2023-12-27 16:26 ` Uwe Kleine-König
2023-12-27 16:26 ` [PATCH 02/11] firmware: arm_scpi: " Uwe Kleine-König
` (4 subsequent siblings)
5 siblings, 0 replies; 9+ messages in thread
From: Uwe Kleine-König @ 2023-12-27 16:26 UTC (permalink / raw)
To: Sudeep Holla; +Cc: kernel, Cristian Marussi, linux-arm-kernel, linux-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/firmware/arm_scmi/driver.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/firmware/arm_scmi/driver.c b/drivers/firmware/arm_scmi/driver.c
index a9f70e6e58ac..3ea64b22cf0d 100644
--- a/drivers/firmware/arm_scmi/driver.c
+++ b/drivers/firmware/arm_scmi/driver.c
@@ -2834,7 +2834,7 @@ static int scmi_probe(struct platform_device *pdev)
return ret;
}
-static int scmi_remove(struct platform_device *pdev)
+static void scmi_remove(struct platform_device *pdev)
{
int id;
struct scmi_info *info = platform_get_drvdata(pdev);
@@ -2868,8 +2868,6 @@ static int scmi_remove(struct platform_device *pdev)
scmi_cleanup_txrx_channels(info);
ida_free(&scmi_id, info->id);
-
- return 0;
}
static ssize_t protocol_version_show(struct device *dev,
@@ -2947,7 +2945,7 @@ static struct platform_driver scmi_driver = {
.dev_groups = versions_groups,
},
.probe = scmi_probe,
- .remove = scmi_remove,
+ .remove_new = scmi_remove,
};
/**
--
2.43.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 02/11] firmware: arm_scpi: Convert to platform remove callback returning void
2023-12-27 16:26 [PATCH 00/11] firmware: Convert to platform remove callback returning void Uwe Kleine-König
2023-12-27 16:26 ` [PATCH 01/11] firmware: arm_scmi: " Uwe Kleine-König
@ 2023-12-27 16:26 ` Uwe Kleine-König
2023-12-27 16:26 ` [PATCH 04/11] firmware: imx-dsp: " Uwe Kleine-König
` (3 subsequent siblings)
5 siblings, 0 replies; 9+ messages in thread
From: Uwe Kleine-König @ 2023-12-27 16:26 UTC (permalink / raw)
To: Sudeep Holla; +Cc: kernel, Cristian Marussi, linux-arm-kernel, linux-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/firmware/arm_scpi.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/firmware/arm_scpi.c b/drivers/firmware/arm_scpi.c
index 3f123f592cb4..94a6b4e667de 100644
--- a/drivers/firmware/arm_scpi.c
+++ b/drivers/firmware/arm_scpi.c
@@ -863,7 +863,7 @@ static void scpi_free_channels(void *data)
mbox_free_channel(info->channels[i].chan);
}
-static int scpi_remove(struct platform_device *pdev)
+static void scpi_remove(struct platform_device *pdev)
{
int i;
struct scpi_drvinfo *info = platform_get_drvdata(pdev);
@@ -874,8 +874,6 @@ static int scpi_remove(struct platform_device *pdev)
kfree(info->dvfs[i]->opps);
kfree(info->dvfs[i]);
}
-
- return 0;
}
#define MAX_SCPI_XFERS 10
@@ -1048,7 +1046,7 @@ static struct platform_driver scpi_driver = {
.dev_groups = versions_groups,
},
.probe = scpi_probe,
- .remove = scpi_remove,
+ .remove_new = scpi_remove,
};
module_platform_driver(scpi_driver);
--
2.43.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 04/11] firmware: imx-dsp: Convert to platform remove callback returning void
2023-12-27 16:26 [PATCH 00/11] firmware: Convert to platform remove callback returning void Uwe Kleine-König
2023-12-27 16:26 ` [PATCH 01/11] firmware: arm_scmi: " Uwe Kleine-König
2023-12-27 16:26 ` [PATCH 02/11] firmware: arm_scpi: " Uwe Kleine-König
@ 2023-12-27 16:26 ` Uwe Kleine-König
2023-12-27 16:26 ` [PATCH 05/11] firmware: mtk-adsp-ipc: " Uwe Kleine-König
` (2 subsequent siblings)
5 siblings, 0 replies; 9+ messages in thread
From: Uwe Kleine-König @ 2023-12-27 16:26 UTC (permalink / raw)
To: Shawn Guo, Sascha Hauer, Daniel Baluta, Thierry Reding,
Sudeep Holla, Hao Ge, Rob Herring, Christophe JAILLET
Cc: kernel, Fabio Estevam, NXP Linux Team, linux-arm-kernel,
linux-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/firmware/imx/imx-dsp.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/firmware/imx/imx-dsp.c b/drivers/firmware/imx/imx-dsp.c
index a48a58e0c61f..01c8ef14eaec 100644
--- a/drivers/firmware/imx/imx-dsp.c
+++ b/drivers/firmware/imx/imx-dsp.c
@@ -160,7 +160,7 @@ static int imx_dsp_probe(struct platform_device *pdev)
return 0;
}
-static int imx_dsp_remove(struct platform_device *pdev)
+static void imx_dsp_remove(struct platform_device *pdev)
{
struct imx_dsp_chan *dsp_chan;
struct imx_dsp_ipc *dsp_ipc;
@@ -173,8 +173,6 @@ static int imx_dsp_remove(struct platform_device *pdev)
mbox_free_channel(dsp_chan->ch);
kfree(dsp_chan->name);
}
-
- return 0;
}
static struct platform_driver imx_dsp_driver = {
@@ -182,7 +180,7 @@ static struct platform_driver imx_dsp_driver = {
.name = "imx-dsp",
},
.probe = imx_dsp_probe,
- .remove = imx_dsp_remove,
+ .remove_new = imx_dsp_remove,
};
builtin_platform_driver(imx_dsp_driver);
--
2.43.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 05/11] firmware: mtk-adsp-ipc: Convert to platform remove callback returning void
2023-12-27 16:26 [PATCH 00/11] firmware: Convert to platform remove callback returning void Uwe Kleine-König
` (2 preceding siblings ...)
2023-12-27 16:26 ` [PATCH 04/11] firmware: imx-dsp: " Uwe Kleine-König
@ 2023-12-27 16:26 ` Uwe Kleine-König
2023-12-27 16:26 ` [PATCH 07/11] firmware: raspberrypi: " Uwe Kleine-König
2023-12-27 16:26 ` [PATCH 11/11] firmware: zynqmp: " Uwe Kleine-König
5 siblings, 0 replies; 9+ messages in thread
From: Uwe Kleine-König @ 2023-12-27 16:26 UTC (permalink / raw)
To: Matthias Brugger, AngeloGioacchino Del Regno, Thierry Reding,
Rob Herring, Arnd Bergmann, Sudeep Holla
Cc: kernel, linux-kernel, linux-arm-kernel, linux-mediatek
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/firmware/mtk-adsp-ipc.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/firmware/mtk-adsp-ipc.c b/drivers/firmware/mtk-adsp-ipc.c
index 85e94ddc7204..a762302978de 100644
--- a/drivers/firmware/mtk-adsp-ipc.c
+++ b/drivers/firmware/mtk-adsp-ipc.c
@@ -116,7 +116,7 @@ static int mtk_adsp_ipc_probe(struct platform_device *pdev)
return 0;
}
-static int mtk_adsp_ipc_remove(struct platform_device *pdev)
+static void mtk_adsp_ipc_remove(struct platform_device *pdev)
{
struct mtk_adsp_ipc *adsp_ipc = dev_get_drvdata(&pdev->dev);
struct mtk_adsp_chan *adsp_chan;
@@ -126,8 +126,6 @@ static int mtk_adsp_ipc_remove(struct platform_device *pdev)
adsp_chan = &adsp_ipc->chans[i];
mbox_free_channel(adsp_chan->ch);
}
-
- return 0;
}
static struct platform_driver mtk_adsp_ipc_driver = {
@@ -135,7 +133,7 @@ static struct platform_driver mtk_adsp_ipc_driver = {
.name = "mtk-adsp-ipc",
},
.probe = mtk_adsp_ipc_probe,
- .remove = mtk_adsp_ipc_remove,
+ .remove_new = mtk_adsp_ipc_remove,
};
builtin_platform_driver(mtk_adsp_ipc_driver);
--
2.43.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 07/11] firmware: raspberrypi: Convert to platform remove callback returning void
2023-12-27 16:26 [PATCH 00/11] firmware: Convert to platform remove callback returning void Uwe Kleine-König
` (3 preceding siblings ...)
2023-12-27 16:26 ` [PATCH 05/11] firmware: mtk-adsp-ipc: " Uwe Kleine-König
@ 2023-12-27 16:26 ` Uwe Kleine-König
2023-12-27 16:43 ` Florian Fainelli
2023-12-27 16:26 ` [PATCH 11/11] firmware: zynqmp: " Uwe Kleine-König
5 siblings, 1 reply; 9+ messages in thread
From: Uwe Kleine-König @ 2023-12-27 16:26 UTC (permalink / raw)
To: Florian Fainelli, Kieran Bingham, Arnd Bergmann, Rob Herring
Cc: kernel, Broadcom internal kernel review list, linux-rpi-kernel,
linux-arm-kernel, linux-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/firmware/raspberrypi.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/firmware/raspberrypi.c b/drivers/firmware/raspberrypi.c
index 4cd290a60fba..322aada20f74 100644
--- a/drivers/firmware/raspberrypi.c
+++ b/drivers/firmware/raspberrypi.c
@@ -317,7 +317,7 @@ static void rpi_firmware_shutdown(struct platform_device *pdev)
rpi_firmware_property(fw, RPI_FIRMWARE_NOTIFY_REBOOT, NULL, 0);
}
-static int rpi_firmware_remove(struct platform_device *pdev)
+static void rpi_firmware_remove(struct platform_device *pdev)
{
struct rpi_firmware *fw = platform_get_drvdata(pdev);
@@ -327,8 +327,6 @@ static int rpi_firmware_remove(struct platform_device *pdev)
rpi_clk = NULL;
rpi_firmware_put(fw);
-
- return 0;
}
static const struct of_device_id rpi_firmware_of_match[] = {
@@ -406,7 +404,7 @@ static struct platform_driver rpi_firmware_driver = {
},
.probe = rpi_firmware_probe,
.shutdown = rpi_firmware_shutdown,
- .remove = rpi_firmware_remove,
+ .remove_new = rpi_firmware_remove,
};
module_platform_driver(rpi_firmware_driver);
--
2.43.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 11/11] firmware: zynqmp: Convert to platform remove callback returning void
2023-12-27 16:26 [PATCH 00/11] firmware: Convert to platform remove callback returning void Uwe Kleine-König
` (4 preceding siblings ...)
2023-12-27 16:26 ` [PATCH 07/11] firmware: raspberrypi: " Uwe Kleine-König
@ 2023-12-27 16:26 ` Uwe Kleine-König
2024-01-02 10:00 ` Michal Simek
5 siblings, 1 reply; 9+ messages in thread
From: Uwe Kleine-König @ 2023-12-27 16:26 UTC (permalink / raw)
To: Michal Simek, Greg Kroah-Hartman, Jay Buddhabhatti,
Sai Krishna Potthuri, Linus Walleij, Nava kishore Manne,
Rajan Vaja, Rob Herring, Dhaval Shah, Marek Vasut
Cc: kernel, linux-arm-kernel, linux-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/firmware/xilinx/zynqmp.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/firmware/xilinx/zynqmp.c b/drivers/firmware/xilinx/zynqmp.c
index a55dfd9bae6b..73cae6ef83ec 100644
--- a/drivers/firmware/xilinx/zynqmp.c
+++ b/drivers/firmware/xilinx/zynqmp.c
@@ -1929,7 +1929,7 @@ static int zynqmp_firmware_probe(struct platform_device *pdev)
return of_platform_populate(dev->of_node, NULL, NULL, dev);
}
-static int zynqmp_firmware_remove(struct platform_device *pdev)
+static void zynqmp_firmware_remove(struct platform_device *pdev)
{
struct pm_api_feature_data *feature_data;
struct hlist_node *tmp;
@@ -1944,8 +1944,6 @@ static int zynqmp_firmware_remove(struct platform_device *pdev)
}
platform_device_unregister(em_dev);
-
- return 0;
}
static const struct of_device_id zynqmp_firmware_of_match[] = {
@@ -1962,6 +1960,6 @@ static struct platform_driver zynqmp_firmware_driver = {
.dev_groups = zynqmp_firmware_groups,
},
.probe = zynqmp_firmware_probe,
- .remove = zynqmp_firmware_remove,
+ .remove_new = zynqmp_firmware_remove,
};
module_platform_driver(zynqmp_firmware_driver);
--
2.43.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 07/11] firmware: raspberrypi: Convert to platform remove callback returning void
2023-12-27 16:26 ` [PATCH 07/11] firmware: raspberrypi: " Uwe Kleine-König
@ 2023-12-27 16:43 ` Florian Fainelli
0 siblings, 0 replies; 9+ messages in thread
From: Florian Fainelli @ 2023-12-27 16:43 UTC (permalink / raw)
To: Uwe Kleine-König, Kieran Bingham, Arnd Bergmann, Rob Herring
Cc: kernel, Broadcom internal kernel review list, linux-rpi-kernel,
linux-arm-kernel, linux-kernel
[-- Attachment #1.1: Type: text/plain, Size: 885 bytes --]
On 12/27/2023 5:26 PM, 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>
Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
--
Florian
[-- Attachment #1.2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4221 bytes --]
[-- Attachment #2: Type: text/plain, Size: 176 bytes --]
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 11/11] firmware: zynqmp: Convert to platform remove callback returning void
2023-12-27 16:26 ` [PATCH 11/11] firmware: zynqmp: " Uwe Kleine-König
@ 2024-01-02 10:00 ` Michal Simek
0 siblings, 0 replies; 9+ messages in thread
From: Michal Simek @ 2024-01-02 10:00 UTC (permalink / raw)
To: Uwe Kleine-König, Greg Kroah-Hartman, Jay Buddhabhatti,
Sai Krishna Potthuri, Linus Walleij, Nava kishore Manne,
Rajan Vaja, Rob Herring, Dhaval Shah, Marek Vasut
Cc: kernel, linux-arm-kernel, linux-kernel
On 12/27/23 17:26, 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/firmware/xilinx/zynqmp.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/firmware/xilinx/zynqmp.c b/drivers/firmware/xilinx/zynqmp.c
> index a55dfd9bae6b..73cae6ef83ec 100644
> --- a/drivers/firmware/xilinx/zynqmp.c
> +++ b/drivers/firmware/xilinx/zynqmp.c
> @@ -1929,7 +1929,7 @@ static int zynqmp_firmware_probe(struct platform_device *pdev)
> return of_platform_populate(dev->of_node, NULL, NULL, dev);
> }
>
> -static int zynqmp_firmware_remove(struct platform_device *pdev)
> +static void zynqmp_firmware_remove(struct platform_device *pdev)
> {
> struct pm_api_feature_data *feature_data;
> struct hlist_node *tmp;
> @@ -1944,8 +1944,6 @@ static int zynqmp_firmware_remove(struct platform_device *pdev)
> }
>
> platform_device_unregister(em_dev);
> -
> - return 0;
> }
>
> static const struct of_device_id zynqmp_firmware_of_match[] = {
> @@ -1962,6 +1960,6 @@ static struct platform_driver zynqmp_firmware_driver = {
> .dev_groups = zynqmp_firmware_groups,
> },
> .probe = zynqmp_firmware_probe,
> - .remove = zynqmp_firmware_remove,
> + .remove_new = zynqmp_firmware_remove,
> };
> module_platform_driver(zynqmp_firmware_driver);
Reviewed-by: Michal Simek <michal.simek@amd.com>
Thanks,
Michal
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2024-01-02 10:01 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-27 16:26 [PATCH 00/11] firmware: Convert to platform remove callback returning void Uwe Kleine-König
2023-12-27 16:26 ` [PATCH 01/11] firmware: arm_scmi: " Uwe Kleine-König
2023-12-27 16:26 ` [PATCH 02/11] firmware: arm_scpi: " Uwe Kleine-König
2023-12-27 16:26 ` [PATCH 04/11] firmware: imx-dsp: " Uwe Kleine-König
2023-12-27 16:26 ` [PATCH 05/11] firmware: mtk-adsp-ipc: " Uwe Kleine-König
2023-12-27 16:26 ` [PATCH 07/11] firmware: raspberrypi: " Uwe Kleine-König
2023-12-27 16:43 ` Florian Fainelli
2023-12-27 16:26 ` [PATCH 11/11] firmware: zynqmp: " Uwe Kleine-König
2024-01-02 10:00 ` Michal Simek
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).