From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de> To: Matthias Brugger <matthias.bgg@gmail.com>, AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>, Thierry Reding <treding@nvidia.com>, Rob Herring <robh@kernel.org>, Arnd Bergmann <arnd@arndb.de>, Sudeep Holla <sudeep.holla@arm.com> Cc: kernel@pengutronix.de, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: [PATCH 05/11] firmware: mtk-adsp-ipc: Convert to platform remove callback returning void Date: Wed, 27 Dec 2023 17:26:29 +0100 [thread overview] Message-ID: <e2ea8abb4c30190392a86cf05cecd722d0f0b493.1703693980.git.u.kleine-koenig@pengutronix.de> (raw) In-Reply-To: <cover.1703693980.git.u.kleine-koenig@pengutronix.de> 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
WARNING: multiple messages have this Message-ID (diff)
From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de> To: Matthias Brugger <matthias.bgg@gmail.com>, AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>, Thierry Reding <treding@nvidia.com>, Rob Herring <robh@kernel.org>, Arnd Bergmann <arnd@arndb.de>, Sudeep Holla <sudeep.holla@arm.com> Cc: kernel@pengutronix.de, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: [PATCH 05/11] firmware: mtk-adsp-ipc: Convert to platform remove callback returning void Date: Wed, 27 Dec 2023 17:26:29 +0100 [thread overview] Message-ID: <e2ea8abb4c30190392a86cf05cecd722d0f0b493.1703693980.git.u.kleine-koenig@pengutronix.de> (raw) In-Reply-To: <cover.1703693980.git.u.kleine-koenig@pengutronix.de> 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
next prev parent reply other threads:[~2023-12-27 16:26 UTC|newest] Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top 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 01/11] firmware: arm_scmi: " 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 2023-12-27 16:26 ` Uwe Kleine-König 2023-12-27 16:26 ` [PATCH 03/11] firmware: coreboot_table: " Uwe Kleine-König 2023-12-28 3:12 ` Tzung-Bi Shih 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 ` Uwe Kleine-König [this message] 2023-12-27 16:26 ` [PATCH 05/11] firmware: mtk-adsp-ipc: " Uwe Kleine-König 2023-12-27 16:26 ` [PATCH 06/11] firmware: qemu_fw_cfg: " Uwe Kleine-König 2023-12-27 17:07 ` Philippe Mathieu-Daudé 2023-12-27 20:46 ` Michael S. Tsirkin 2023-12-27 16:26 ` [PATCH 07/11] firmware: raspberrypi: " Uwe Kleine-König 2023-12-27 16:26 ` Uwe Kleine-König 2023-12-27 16:43 ` Florian Fainelli 2023-12-27 16:43 ` Florian Fainelli 2023-12-27 16:26 ` [PATCH 08/11] firmware: stratix10-rsu: " Uwe Kleine-König 2024-01-04 12:22 ` Dinh Nguyen 2023-12-27 16:26 ` [PATCH 09/11] firmware: stratix10-svc: " Uwe Kleine-König 2024-01-04 12:22 ` Dinh Nguyen 2023-12-27 16:26 ` [PATCH 10/11] firmware: turris-mox-rwtm: " Uwe Kleine-König 2023-12-28 15:32 ` Marek Behún 2023-12-27 16:26 ` [PATCH 11/11] firmware: zynqmp: " Uwe Kleine-König 2023-12-27 16:26 ` Uwe Kleine-König 2024-01-02 10:00 ` Michal Simek 2024-01-02 10:00 ` Michal Simek
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=e2ea8abb4c30190392a86cf05cecd722d0f0b493.1703693980.git.u.kleine-koenig@pengutronix.de \ --to=u.kleine-koenig@pengutronix.de \ --cc=angelogioacchino.delregno@collabora.com \ --cc=arnd@arndb.de \ --cc=kernel@pengutronix.de \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-mediatek@lists.infradead.org \ --cc=matthias.bgg@gmail.com \ --cc=robh@kernel.org \ --cc=sudeep.holla@arm.com \ --cc=treding@nvidia.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.