From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de> To: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Cc: kernel@pengutronix.de, Yong Wu <yong.wu@mediatek.com>, Matthias Brugger <matthias.bgg@gmail.com>, AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH 07/15] memory: mtk-smi: Convert to platform remove callback returning void Date: Sun, 17 Dec 2023 15:29:33 +0100 [thread overview] Message-ID: <5c35a33cfdc359842e034ddd2e9358f10e91fa1f.1702822744.git.u.kleine-koenig@pengutronix.de> (raw) In-Reply-To: <cover.1702822744.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/memory/mtk-smi.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/memory/mtk-smi.c b/drivers/memory/mtk-smi.c index 6523cb510518..572c7fbdcfd3 100644 --- a/drivers/memory/mtk-smi.c +++ b/drivers/memory/mtk-smi.c @@ -566,14 +566,13 @@ static int mtk_smi_larb_probe(struct platform_device *pdev) return ret; } -static int mtk_smi_larb_remove(struct platform_device *pdev) +static void mtk_smi_larb_remove(struct platform_device *pdev) { struct mtk_smi_larb *larb = platform_get_drvdata(pdev); device_link_remove(&pdev->dev, larb->smi_common_dev); pm_runtime_disable(&pdev->dev); component_del(&pdev->dev, &mtk_smi_larb_component_ops); - return 0; } static int __maybe_unused mtk_smi_larb_resume(struct device *dev) @@ -616,7 +615,7 @@ static const struct dev_pm_ops smi_larb_pm_ops = { static struct platform_driver mtk_smi_larb_driver = { .probe = mtk_smi_larb_probe, - .remove = mtk_smi_larb_remove, + .remove_new = mtk_smi_larb_remove, .driver = { .name = "mtk-smi-larb", .of_match_table = mtk_smi_larb_of_ids, @@ -795,14 +794,13 @@ static int mtk_smi_common_probe(struct platform_device *pdev) return 0; } -static int mtk_smi_common_remove(struct platform_device *pdev) +static void mtk_smi_common_remove(struct platform_device *pdev) { struct mtk_smi *common = dev_get_drvdata(&pdev->dev); if (common->plat->type == MTK_SMI_GEN2_SUB_COMM) device_link_remove(&pdev->dev, common->smi_common_dev); pm_runtime_disable(&pdev->dev); - return 0; } static int __maybe_unused mtk_smi_common_resume(struct device *dev) @@ -842,7 +840,7 @@ static const struct dev_pm_ops smi_common_pm_ops = { static struct platform_driver mtk_smi_common_driver = { .probe = mtk_smi_common_probe, - .remove = mtk_smi_common_remove, + .remove_new = mtk_smi_common_remove, .driver = { .name = "mtk-smi-common", .of_match_table = mtk_smi_common_of_ids, -- 2.42.0
WARNING: multiple messages have this Message-ID (diff)
From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de> To: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Cc: kernel@pengutronix.de, Yong Wu <yong.wu@mediatek.com>, Matthias Brugger <matthias.bgg@gmail.com>, AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH 07/15] memory: mtk-smi: Convert to platform remove callback returning void Date: Sun, 17 Dec 2023 15:29:33 +0100 [thread overview] Message-ID: <5c35a33cfdc359842e034ddd2e9358f10e91fa1f.1702822744.git.u.kleine-koenig@pengutronix.de> (raw) In-Reply-To: <cover.1702822744.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/memory/mtk-smi.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/memory/mtk-smi.c b/drivers/memory/mtk-smi.c index 6523cb510518..572c7fbdcfd3 100644 --- a/drivers/memory/mtk-smi.c +++ b/drivers/memory/mtk-smi.c @@ -566,14 +566,13 @@ static int mtk_smi_larb_probe(struct platform_device *pdev) return ret; } -static int mtk_smi_larb_remove(struct platform_device *pdev) +static void mtk_smi_larb_remove(struct platform_device *pdev) { struct mtk_smi_larb *larb = platform_get_drvdata(pdev); device_link_remove(&pdev->dev, larb->smi_common_dev); pm_runtime_disable(&pdev->dev); component_del(&pdev->dev, &mtk_smi_larb_component_ops); - return 0; } static int __maybe_unused mtk_smi_larb_resume(struct device *dev) @@ -616,7 +615,7 @@ static const struct dev_pm_ops smi_larb_pm_ops = { static struct platform_driver mtk_smi_larb_driver = { .probe = mtk_smi_larb_probe, - .remove = mtk_smi_larb_remove, + .remove_new = mtk_smi_larb_remove, .driver = { .name = "mtk-smi-larb", .of_match_table = mtk_smi_larb_of_ids, @@ -795,14 +794,13 @@ static int mtk_smi_common_probe(struct platform_device *pdev) return 0; } -static int mtk_smi_common_remove(struct platform_device *pdev) +static void mtk_smi_common_remove(struct platform_device *pdev) { struct mtk_smi *common = dev_get_drvdata(&pdev->dev); if (common->plat->type == MTK_SMI_GEN2_SUB_COMM) device_link_remove(&pdev->dev, common->smi_common_dev); pm_runtime_disable(&pdev->dev); - return 0; } static int __maybe_unused mtk_smi_common_resume(struct device *dev) @@ -842,7 +840,7 @@ static const struct dev_pm_ops smi_common_pm_ops = { static struct platform_driver mtk_smi_common_driver = { .probe = mtk_smi_common_probe, - .remove = mtk_smi_common_remove, + .remove_new = mtk_smi_common_remove, .driver = { .name = "mtk-smi-common", .of_match_table = mtk_smi_common_of_ids, -- 2.42.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-17 14:30 UTC|newest] Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-12-17 14:29 [PATCH 00/15] memory: Convert to platform remove callback returning void Uwe Kleine-König 2023-12-17 14:29 ` Uwe Kleine-König 2023-12-17 14:29 ` [PATCH 01/15] memory: brcmstb_dpfe: " Uwe Kleine-König 2023-12-17 14:29 ` Uwe Kleine-König 2023-12-18 6:56 ` Markus Mayer 2023-12-18 6:56 ` Markus Mayer 2023-12-17 14:29 ` [PATCH 02/15] memory: brcmstb_memc: " Uwe Kleine-König 2023-12-17 14:29 ` Uwe Kleine-König 2023-12-17 14:29 ` [PATCH 03/15] memory: emif: " Uwe Kleine-König 2023-12-17 14:29 ` [PATCH 04/15] memory: fsl-corenet-cf: " Uwe Kleine-König 2023-12-17 14:29 ` [PATCH 05/15] memory: fsl_ifc: " Uwe Kleine-König 2023-12-17 14:29 ` [PATCH 06/15] memory: jz4780-nemc: " Uwe Kleine-König 2023-12-17 14:40 ` Paul Cercueil 2023-12-17 14:29 ` Uwe Kleine-König [this message] 2023-12-17 14:29 ` [PATCH 07/15] memory: mtk-smi: " Uwe Kleine-König 2023-12-17 14:29 ` [PATCH 08/15] memory: omap-gpmc: " Uwe Kleine-König 2023-12-18 8:37 ` Tony Lindgren 2023-12-17 14:29 ` [PATCH 09/15] memory: renesas-rpc-if: " Uwe Kleine-König 2023-12-17 14:29 ` [PATCH 10/15] memory: exynos5422-dmc: " Uwe Kleine-König 2023-12-17 14:29 ` Uwe Kleine-König 2023-12-17 14:29 ` [PATCH 11/15] memory: stm32-fmc2-ebi: " Uwe Kleine-König 2023-12-17 14:29 ` Uwe Kleine-König 2023-12-17 14:29 ` [PATCH 12/15] memory: tegra186-emc: " Uwe Kleine-König 2023-12-17 14:29 ` [PATCH 13/15] memory: tegra210-emc: " Uwe Kleine-König 2023-12-17 14:29 ` [PATCH 14/15] memory: ti-aemif: " Uwe Kleine-König 2023-12-17 14:29 ` [PATCH 15/15] memory: ti-emif-pm: " Uwe Kleine-König 2023-12-19 8:06 ` [PATCH 00/15] memory: " Krzysztof Kozlowski 2023-12-19 8:06 ` Krzysztof Kozlowski 2023-12-19 8:06 ` Krzysztof Kozlowski 2023-12-19 8:06 ` Krzysztof Kozlowski
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=5c35a33cfdc359842e034ddd2e9358f10e91fa1f.1702822744.git.u.kleine-koenig@pengutronix.de \ --to=u.kleine-koenig@pengutronix.de \ --cc=angelogioacchino.delregno@collabora.com \ --cc=kernel@pengutronix.de \ --cc=krzysztof.kozlowski@linaro.org \ --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=yong.wu@mediatek.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.