From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de> To: MyungJoo Ham <myungjoo.ham@samsung.com>, Kyungmin Park <kyungmin.park@samsung.com>, Chanwoo Choi <cw00.choi@samsung.com> Cc: Matthias Brugger <matthias.bgg@gmail.com>, AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>, linux-pm@vger.kernel.org, kernel@pengutronix.de, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: [PATCH 3/5] PM / devfreq: mtk-cci: Convert to platform remove callback returning void Date: Mon, 4 Mar 2024 22:28:41 +0100 [thread overview] Message-ID: <fbc7b0a577de0c0fc46cf1b9e1a03a9c46bf79e0.1709587301.git.u.kleine-koenig@pengutronix.de> (raw) In-Reply-To: <cover.1709587301.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/devfreq/mtk-cci-devfreq.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/devfreq/mtk-cci-devfreq.c b/drivers/devfreq/mtk-cci-devfreq.c index 11bc3d03494c..7ad5225b0381 100644 --- a/drivers/devfreq/mtk-cci-devfreq.c +++ b/drivers/devfreq/mtk-cci-devfreq.c @@ -392,7 +392,7 @@ static int mtk_ccifreq_probe(struct platform_device *pdev) return ret; } -static int mtk_ccifreq_remove(struct platform_device *pdev) +static void mtk_ccifreq_remove(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct mtk_ccifreq_drv *drv; @@ -405,8 +405,6 @@ static int mtk_ccifreq_remove(struct platform_device *pdev) regulator_disable(drv->proc_reg); if (drv->sram_reg) regulator_disable(drv->sram_reg); - - return 0; } static const struct mtk_ccifreq_platform_data mt8183_platform_data = { @@ -432,7 +430,7 @@ MODULE_DEVICE_TABLE(of, mtk_ccifreq_machines); static struct platform_driver mtk_ccifreq_platdrv = { .probe = mtk_ccifreq_probe, - .remove = mtk_ccifreq_remove, + .remove_new = mtk_ccifreq_remove, .driver = { .name = "mtk-ccifreq", .of_match_table = mtk_ccifreq_machines, -- 2.43.0
WARNING: multiple messages have this Message-ID (diff)
From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de> To: MyungJoo Ham <myungjoo.ham@samsung.com>, Kyungmin Park <kyungmin.park@samsung.com>, Chanwoo Choi <cw00.choi@samsung.com> Cc: Matthias Brugger <matthias.bgg@gmail.com>, AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>, linux-pm@vger.kernel.org, kernel@pengutronix.de, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: [PATCH 3/5] PM / devfreq: mtk-cci: Convert to platform remove callback returning void Date: Mon, 4 Mar 2024 22:28:41 +0100 [thread overview] Message-ID: <fbc7b0a577de0c0fc46cf1b9e1a03a9c46bf79e0.1709587301.git.u.kleine-koenig@pengutronix.de> (raw) In-Reply-To: <cover.1709587301.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/devfreq/mtk-cci-devfreq.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/devfreq/mtk-cci-devfreq.c b/drivers/devfreq/mtk-cci-devfreq.c index 11bc3d03494c..7ad5225b0381 100644 --- a/drivers/devfreq/mtk-cci-devfreq.c +++ b/drivers/devfreq/mtk-cci-devfreq.c @@ -392,7 +392,7 @@ static int mtk_ccifreq_probe(struct platform_device *pdev) return ret; } -static int mtk_ccifreq_remove(struct platform_device *pdev) +static void mtk_ccifreq_remove(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct mtk_ccifreq_drv *drv; @@ -405,8 +405,6 @@ static int mtk_ccifreq_remove(struct platform_device *pdev) regulator_disable(drv->proc_reg); if (drv->sram_reg) regulator_disable(drv->sram_reg); - - return 0; } static const struct mtk_ccifreq_platform_data mt8183_platform_data = { @@ -432,7 +430,7 @@ MODULE_DEVICE_TABLE(of, mtk_ccifreq_machines); static struct platform_driver mtk_ccifreq_platdrv = { .probe = mtk_ccifreq_probe, - .remove = mtk_ccifreq_remove, + .remove_new = mtk_ccifreq_remove, .driver = { .name = "mtk-ccifreq", .of_match_table = mtk_ccifreq_machines, -- 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:[~2024-03-04 21:29 UTC|newest] Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top [not found] <CGME20240304212922epcas1p3f9a8c4fdf976f6d6266e3129bfcfb00c@epcas1p3.samsung.com> 2024-03-04 21:28 ` [PATCH 0/5] PM / devfreq: Convert to platform remove callback returning void Uwe Kleine-König 2024-03-04 21:28 ` Uwe Kleine-König 2024-03-04 21:28 ` [PATCH 1/5] PM / devfreq: exynos-nocp: " Uwe Kleine-König 2024-03-04 21:28 ` Uwe Kleine-König 2024-03-04 21:28 ` [PATCH 2/5] PM / devfreq: exynos-ppmu: " Uwe Kleine-König 2024-03-04 21:28 ` Uwe Kleine-König 2024-03-04 21:28 ` Uwe Kleine-König [this message] 2024-03-04 21:28 ` [PATCH 3/5] PM / devfreq: mtk-cci: " Uwe Kleine-König 2024-03-04 21:28 ` [PATCH 4/5] PM / devfreq: rk3399_dmc: " Uwe Kleine-König 2024-03-04 21:28 ` [PATCH 5/5] PM / devfreq: sun8i-a33-mbus: " Uwe Kleine-König 2024-03-04 21:28 ` Uwe Kleine-König 2024-03-04 21:32 ` Jernej Škrabec 2024-03-04 21:32 ` Jernej Škrabec 2024-03-07 11:54 ` [PATCH 0/5] PM / devfreq: " Chanwoo Choi 2024-03-07 11:54 ` Chanwoo Choi
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=fbc7b0a577de0c0fc46cf1b9e1a03a9c46bf79e0.1709587301.git.u.kleine-koenig@pengutronix.de \ --to=u.kleine-koenig@pengutronix.de \ --cc=angelogioacchino.delregno@collabora.com \ --cc=cw00.choi@samsung.com \ --cc=kernel@pengutronix.de \ --cc=kyungmin.park@samsung.com \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-mediatek@lists.infradead.org \ --cc=linux-pm@vger.kernel.org \ --cc=matthias.bgg@gmail.com \ --cc=myungjoo.ham@samsung.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.