* [PATCH] mmc: mxs-mmc: disable regulator on error and in the remove function
@ 2021-10-16 6:21 Christophe JAILLET
2021-10-19 11:36 ` Ulf Hansson
0 siblings, 1 reply; 2+ messages in thread
From: Christophe JAILLET @ 2021-10-16 6:21 UTC (permalink / raw)
To: ulf.hansson, shawnguo, s.hauer, kernel, festevam, linux-imx, cjb
Cc: linux-mmc, linux-arm-kernel, linux-kernel, kernel-janitors,
Christophe JAILLET
The 'reg_vmmc' regulator is enabled in the probe. It is never disabled.
Neither in the error handling path of the probe nor in the remove
function.
Register a devm_action to disable it when needed.
Fixes: 4dc5a79f1350 ("mmc: mxs-mmc: enable regulator for mmc slot")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
drivers/mmc/host/mxs-mmc.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/drivers/mmc/host/mxs-mmc.c b/drivers/mmc/host/mxs-mmc.c
index 947581de7860..8c3655d3be96 100644
--- a/drivers/mmc/host/mxs-mmc.c
+++ b/drivers/mmc/host/mxs-mmc.c
@@ -552,6 +552,11 @@ static const struct of_device_id mxs_mmc_dt_ids[] = {
};
MODULE_DEVICE_TABLE(of, mxs_mmc_dt_ids);
+static void mxs_mmc_regulator_disable(void *regulator)
+{
+ regulator_disable(regulator);
+}
+
static int mxs_mmc_probe(struct platform_device *pdev)
{
struct device_node *np = pdev->dev.of_node;
@@ -591,6 +596,11 @@ static int mxs_mmc_probe(struct platform_device *pdev)
"Failed to enable vmmc regulator: %d\n", ret);
goto out_mmc_free;
}
+
+ ret = devm_add_action_or_reset(&pdev->dev, mxs_mmc_regulator_disable,
+ reg_vmmc);
+ if (ret)
+ goto out_mmc_free;
}
ssp->clk = devm_clk_get(&pdev->dev, NULL);
--
2.30.2
_______________________________________________
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] 2+ messages in thread
* Re: [PATCH] mmc: mxs-mmc: disable regulator on error and in the remove function
2021-10-16 6:21 [PATCH] mmc: mxs-mmc: disable regulator on error and in the remove function Christophe JAILLET
@ 2021-10-19 11:36 ` Ulf Hansson
0 siblings, 0 replies; 2+ messages in thread
From: Ulf Hansson @ 2021-10-19 11:36 UTC (permalink / raw)
To: Christophe JAILLET
Cc: Shawn Guo, Sascha Hauer, Sascha Hauer, Fabio Estevam,
dl-linux-imx, Chris Ball, linux-mmc, Linux ARM,
Linux Kernel Mailing List, kernel-janitors
On Sat, 16 Oct 2021 at 08:21, Christophe JAILLET
<christophe.jaillet@wanadoo.fr> wrote:
>
> The 'reg_vmmc' regulator is enabled in the probe. It is never disabled.
> Neither in the error handling path of the probe nor in the remove
> function.
>
> Register a devm_action to disable it when needed.
>
> Fixes: 4dc5a79f1350 ("mmc: mxs-mmc: enable regulator for mmc slot")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Applied for next, thanks!
Kind regards
Uffe
> ---
> drivers/mmc/host/mxs-mmc.c | 10 ++++++++++
> 1 file changed, 10 insertions(+)
>
> diff --git a/drivers/mmc/host/mxs-mmc.c b/drivers/mmc/host/mxs-mmc.c
> index 947581de7860..8c3655d3be96 100644
> --- a/drivers/mmc/host/mxs-mmc.c
> +++ b/drivers/mmc/host/mxs-mmc.c
> @@ -552,6 +552,11 @@ static const struct of_device_id mxs_mmc_dt_ids[] = {
> };
> MODULE_DEVICE_TABLE(of, mxs_mmc_dt_ids);
>
> +static void mxs_mmc_regulator_disable(void *regulator)
> +{
> + regulator_disable(regulator);
> +}
> +
> static int mxs_mmc_probe(struct platform_device *pdev)
> {
> struct device_node *np = pdev->dev.of_node;
> @@ -591,6 +596,11 @@ static int mxs_mmc_probe(struct platform_device *pdev)
> "Failed to enable vmmc regulator: %d\n", ret);
> goto out_mmc_free;
> }
> +
> + ret = devm_add_action_or_reset(&pdev->dev, mxs_mmc_regulator_disable,
> + reg_vmmc);
> + if (ret)
> + goto out_mmc_free;
> }
>
> ssp->clk = devm_clk_get(&pdev->dev, NULL);
> --
> 2.30.2
>
_______________________________________________
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] 2+ messages in thread
end of thread, other threads:[~2021-10-19 11:38 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-16 6:21 [PATCH] mmc: mxs-mmc: disable regulator on error and in the remove function Christophe JAILLET
2021-10-19 11:36 ` Ulf Hansson
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).