firmware: Convert to platform remove callback returning void
Subsystems (9)
cover firmware: Convert to platform remove callback returning void
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
Signature · 1 line
2.43.0
PATCH 1/11 firmware: arm_scmi: 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.
--- drivers/firmware/arm_scmi/driver.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/firmware/arm_scmi/driver.c +2 -4
@@ -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, };/**
Signature · 1 line
2.43.0
PATCH 2/11 firmware: arm_scpi: Convert to platform remove callback returning void
In reply to Uwe Kleine-KönigThe .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.
--- drivers/firmware/arm_scpi.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/firmware/arm_scpi.c +2 -4
@@ -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);
Signature · 1 line
2.43.0
PATCH 3/11 firmware: coreboot_table: Convert to platform remove callback returning void
In reply to Uwe Kleine-KönigThe .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.
--- drivers/firmware/google/coreboot_table.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/firmware/google/coreboot_table.c +2 -3
@@ -176,10 +176,9 @@ static int __cb_dev_unregister(struct device *dev, void *dummy)return 0 ; } -static int coreboot_table_remove (struct platform_device *pdev) +static void coreboot_table_remove (struct platform_device *pdev) {bus_for_each_dev (&coreboot_bus_type,NULL ,NULL , __cb_dev_unregister); -return 0 ; }#ifdef CONFIG_ACPI
@@ -201,7 +200,7 @@ MODULE_DEVICE_TABLE(of, coreboot_of_match);static struct platform_driver coreboot_table_driver = { .probe = coreboot_table_probe, - .remove = coreboot_table_remove, + .remove_new = coreboot_table_remove, .driver = { .name ="coreboot_table" , .acpi_match_table =ACPI_PTR (cros_coreboot_acpi_match),
Signature · 1 line
2.43.0
Tzung-Bi Shih
AppliedRe: [PATCH 03/11] firmware: coreboot_table: Convert to platform remove callback returning void
Quoted 11 lines · Uwe Kleine-König
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().
[...]
Applied, thanks!
[03/11] firmware: coreboot: Convert to platform remove callback returning void
commit: 09aeaabebdafbcf4afd1c481beaff37ecbc6b023
PATCH 4/11 firmware: imx-dsp: Convert to platform remove callback returning void
In reply to Uwe Kleine-KönigThe .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.
--- drivers/firmware/imx/imx-dsp.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/firmware/imx/imx-dsp.c +2 -4
@@ -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);
Signature · 1 line
2.43.0
PATCH 5/11 firmware: mtk-adsp-ipc: Convert to platform remove callback returning void
In reply to Uwe Kleine-KönigThe .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.
--- drivers/firmware/mtk-adsp-ipc.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/firmware/mtk-adsp-ipc.c +2 -4
@@ -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);
Signature · 1 line
2.43.0
PATCH 6/11 firmware: qemu_fw_cfg: Convert to platform remove callback returning void
In reply to Uwe Kleine-KönigThe .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.
--- drivers/firmware/qemu_fw_cfg.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/firmware/qemu_fw_cfg.c +2 -3
@@ -731,7 +731,7 @@ static int fw_cfg_sysfs_probe(struct platform_device *pdev)return err; } -static int fw_cfg_sysfs_remove (struct platform_device *pdev) +static void fw_cfg_sysfs_remove (struct platform_device *pdev) {pr_debug ("fw_cfg: unloading.\n" );fw_cfg_sysfs_cache_cleanup ();
@@ -739,7 +739,6 @@ static int fw_cfg_sysfs_remove(struct platform_device *pdev)fw_cfg_io_cleanup ();fw_cfg_kset_unregister_recursive (fw_cfg_fname_kset);fw_cfg_kobj_cleanup (fw_cfg_sel_ko); -return 0 ; }static const struct of_device_id fw_cfg_sysfs_mmio_match[] = {
@@ -758,7 +757,7 @@ MODULE_DEVICE_TABLE(acpi, fw_cfg_sysfs_acpi_match);static struct platform_driver fw_cfg_sysfs_driver = { .probe = fw_cfg_sysfs_probe, - .remove = fw_cfg_sysfs_remove, + .remove_new = fw_cfg_sysfs_remove, .driver = { .name ="fw_cfg" , .of_match_table = fw_cfg_sysfs_mmio_match,
Signature · 1 line
2.43.0
Re: [PATCH 06/11] firmware: qemu_fw_cfg: Convert to platform remove callback returning void
Quoted 10 lines · Uwe Kleine-König
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().
Quoted 7 lines
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/firmware/qemu_fw_cfg.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
Re: [PATCH 06/11] firmware: qemu_fw_cfg: Convert to platform remove callback returning void
In reply to Uwe Kleine-KönigQuoted 10 lines · Uwe Kleine-König
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().
Quoted 4 lines
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]>
I don't mind.
Quoted 36 lines
--- drivers/firmware/qemu_fw_cfg.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)drivers/firmware/qemu_fw_cfg.c +2
-3@@ -731,7 +731,7 @@ static int fw_cfg_sysfs_probe(struct platform_device *pdev)return err; } -static int fw_cfg_sysfs_remove (struct platform_device *pdev) +static void fw_cfg_sysfs_remove (struct platform_device *pdev) {pr_debug ("fw_cfg: unloading.\n" );fw_cfg_sysfs_cache_cleanup ();@@ -739,7 +739,6 @@ static int fw_cfg_sysfs_remove(struct platform_device *pdev)fw_cfg_io_cleanup ();fw_cfg_kset_unregister_recursive (fw_cfg_fname_kset);fw_cfg_kobj_cleanup (fw_cfg_sel_ko); -return 0 ; }static const struct of_device_id fw_cfg_sysfs_mmio_match[] = {@@ -758,7 +757,7 @@ MODULE_DEVICE_TABLE(acpi, fw_cfg_sysfs_acpi_match);static struct platform_driver fw_cfg_sysfs_driver = { .probe = fw_cfg_sysfs_probe, - .remove = fw_cfg_sysfs_remove, + .remove_new = fw_cfg_sysfs_remove, .driver = { .name ="fw_cfg" , .of_match_table = fw_cfg_sysfs_mmio_match,Signature · 1 line
2.43.0
PATCH 7/11 firmware: raspberrypi: Convert to platform remove callback returning void
In reply to Uwe Kleine-KönigThe .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.
--- drivers/firmware/raspberrypi.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/firmware/raspberrypi.c +2 -4
@@ -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);
Signature · 1 line
2.43.0
Re: [PATCH 07/11] firmware: raspberrypi: Convert to platform remove callback returning void
Quoted 10 lines · Uwe Kleine-König
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().
Quoted 4 lines
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]>
Signature · 1 line
Florian
PATCH 8/11 firmware: stratix10-rsu: Convert to platform remove callback returning void
In reply to Uwe Kleine-KönigThe .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.
--- drivers/firmware/stratix10-rsu.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/firmware/stratix10-rsu.c +2 -3
@@ -793,17 +793,16 @@ static int stratix10_rsu_probe(struct platform_device *pdev)return ret; } -static int stratix10_rsu_remove (struct platform_device *pdev) +static void stratix10_rsu_remove (struct platform_device *pdev) {struct stratix10_rsu_priv *priv =platform_get_drvdata (pdev);stratix10_svc_free_channel (priv->chan); -return 0 ; }static struct platform_driver stratix10_rsu_driver = { .probe = stratix10_rsu_probe, - .remove = stratix10_rsu_remove, + .remove_new = stratix10_rsu_remove, .driver = { .name ="stratix10-rsu" , .dev_groups = rsu_groups,
Signature · 1 line
2.43.0
Re: [PATCH 08/11] firmware: stratix10-rsu: Convert to platform remove callback returning void
Quoted 32 lines · Uwe Kleine-König
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/firmware/stratix10-rsu.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)drivers/firmware/stratix10-rsu.c +1
-1@@ -793,17 +793,16 @@ static int stratix10_rsu_probe(struct platform_device *pdev)return ret; } -static int stratix10_rsu_remove (struct platform_device *pdev) +static void stratix10_rsu_remove (struct platform_device *pdev) {struct stratix10_rsu_priv *priv =platform_get_drvdata (pdev);stratix10_svc_free_channel (priv->chan);
drivers/firmware/stratix10-rsu.c static int stratix10_rsu_probe(struct platform_device *pdev) · line 808
Quoted 10 lines
drivers/firmware/stratix10-rsu.c +1
-2-return 0 ; }static struct platform_driver stratix10_rsu_driver = { .probe = stratix10_rsu_probe, - .remove = stratix10_rsu_remove, + .remove_new = stratix10_rsu_remove, .driver = { .name ="stratix10-rsu" , .dev_groups = rsu_groups,
PATCH 9/11 firmware: stratix10-svc: Convert to platform remove callback returning void
In reply to Uwe Kleine-KönigThe .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.
--- drivers/firmware/stratix10-svc.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/firmware/stratix10-svc.c +2 -4
@@ -1251,7 +1251,7 @@ static int stratix10_svc_drv_probe(struct platform_device *pdev)return ret; } -static int stratix10_svc_drv_remove (struct platform_device *pdev) +static void stratix10_svc_drv_remove (struct platform_device *pdev) {struct stratix10_svc *svc =dev_get_drvdata (&pdev->dev);struct stratix10_svc_controller *ctrl =platform_get_drvdata (pdev);
@@ -1267,13 +1267,11 @@ static int stratix10_svc_drv_remove(struct platform_device *pdev)if (ctrl->genpool)gen_pool_destroy (ctrl->genpool);list_del (&ctrl->node); - -return 0 ; }static struct platform_driver stratix10_svc_driver = { .probe = stratix10_svc_drv_probe, - .remove = stratix10_svc_drv_remove, + .remove_new = stratix10_svc_drv_remove, .driver = { .name ="stratix10-svc" , .of_match_table = stratix10_svc_drv_match,
Signature · 1 line
2.43.0
Re: [PATCH 09/11] firmware: stratix10-svc: Convert to platform remove callback returning void
Quoted 36 lines · Uwe Kleine-König
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/firmware/stratix10-svc.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)drivers/firmware/stratix10-svc.c +1
-2@@ -1251,7 +1251,7 @@ static int stratix10_svc_drv_probe(struct platform_device *pdev)return ret; } -static int stratix10_svc_drv_remove (struct platform_device *pdev) +static void stratix10_svc_drv_remove (struct platform_device *pdev) {struct stratix10_svc *svc =dev_get_drvdata (&pdev->dev);struct stratix10_svc_controller *ctrl =platform_get_drvdata (pdev);@@ -1267,13 +1267,11 @@ static int stratix10_svc_drv_remove(struct platform_device *pdev)if (ctrl->genpool)gen_pool_destroy (ctrl->genpool);list_del (&ctrl->node); -
drivers/firmware/stratix10-svc.c static int stratix10_svc_drv_remove(struct platform_device *pdev) · line 1277
Quoted 10 lines
drivers/firmware/stratix10-svc.c +1
-2-return 0 ; }static struct platform_driver stratix10_svc_driver = { .probe = stratix10_svc_drv_probe, - .remove = stratix10_svc_drv_remove, + .remove_new = stratix10_svc_drv_remove, .driver = { .name ="stratix10-svc" , .of_match_table = stratix10_svc_drv_match,
PATCH 10/11 firmware: turris-mox-rwtm: Convert to platform remove callback returning void
In reply to Uwe Kleine-KönigThe .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.
--- drivers/firmware/turris-mox-rwtm.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/firmware/turris-mox-rwtm.c +2 -4
@@ -554,7 +554,7 @@ static int turris_mox_rwtm_probe(struct platform_device *pdev)return ret; } -static int turris_mox_rwtm_remove (struct platform_device *pdev) +static void turris_mox_rwtm_remove (struct platform_device *pdev) {struct mox_rwtm *rwtm =platform_get_drvdata (pdev);
@@ -562,8 +562,6 @@ static int turris_mox_rwtm_remove(struct platform_device *pdev)sysfs_remove_files (rwtm_to_kobj (rwtm), mox_rwtm_attrs);kobject_put (rwtm_to_kobj (rwtm));mbox_free_channel (rwtm->mbox); - -return 0 ; }static const struct of_device_id turris_mox_rwtm_match[] = {
@@ -576,7 +574,7 @@ MODULE_DEVICE_TABLE(of, turris_mox_rwtm_match);static struct platform_driver turris_mox_rwtm_driver = { .probe = turris_mox_rwtm_probe, - .remove = turris_mox_rwtm_remove, + .remove_new = turris_mox_rwtm_remove, .driver = { .name =DRIVER_NAME , .of_match_table = turris_mox_rwtm_match,
Signature · 1 line
2.43.0
Re: [PATCH 10/11] firmware: turris-mox-rwtm: Convert to platform remove callback returning void
Quoted 41 lines · On Wed, 27 Dec 2023 17:26:34 +0100 Uwe Kleine-König…
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/firmware/turris-mox-rwtm.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)drivers/firmware/turris-mox-rwtm.c +1
-3@@ -554,7 +554,7 @@ static int turris_mox_rwtm_probe(struct platform_device *pdev)return ret; } -static int turris_mox_rwtm_remove (struct platform_device *pdev) +static void turris_mox_rwtm_remove (struct platform_device *pdev) {struct mox_rwtm *rwtm =platform_get_drvdata (pdev);@@ -562,8 +562,6 @@ static int turris_mox_rwtm_remove(struct platform_device *pdev)sysfs_remove_files (rwtm_to_kobj (rwtm), mox_rwtm_attrs);kobject_put (rwtm_to_kobj (rwtm));mbox_free_channel (rwtm->mbox); - -return 0 ; }static const struct of_device_id turris_mox_rwtm_match[] = {
drivers/firmware/turris-mox-rwtm.c MODULE_DEVICE_TABLE(of, turris_mox_rwtm_match); · line 580
Quoted 8 lines
drivers/firmware/turris-mox-rwtm.c +1
-1@@ -576,7 +574,7 @@ MODULE_DEVICE_TABLE(of, turris_mox_rwtm_match);static struct platform_driver turris_mox_rwtm_driver = { .probe = turris_mox_rwtm_probe, - .remove = turris_mox_rwtm_remove, + .remove_new = turris_mox_rwtm_remove, .driver = { .name =DRIVER_NAME , .of_match_table = turris_mox_rwtm_match,
PATCH 11/11 firmware: zynqmp: Convert to platform remove callback returning void
In reply to Uwe Kleine-KönigThe .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.
--- drivers/firmware/xilinx/zynqmp.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/firmware/xilinx/zynqmp.c +2 -4
@@ -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);
Signature · 1 line
2.43.0
Re: [PATCH 11/11] firmware: zynqmp: Convert to platform remove callback returning void
Quoted 41 lines · Uwe Kleine-König
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/firmware/xilinx/zynqmp.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)drivers/firmware/xilinx/zynqmp.c +1
-3@@ -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[] = {
drivers/firmware/xilinx/zynqmp.c static struct platform_driver zynqmp_firmware_driver = { · line 1965
Quoted 7 lines
drivers/firmware/xilinx/zynqmp.c +1
-1@@ -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);
Thanks,
Michal