lkml.org 
[lkml]   [2021]   [May]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] mmc: mxs-mmc: Disable the 'reg_vmmc' regulator when needed
Date
The 'reg_vmmc' regulator is never disabled. Neither in the error handling
of the probe, nor in the remove function.

Add a managed action to do the required clean-up before a 'regulator_put()'
call.

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 | 11 +++++++++++
1 file changed, 11 insertions(+)

diff --git a/drivers/mmc/host/mxs-mmc.c b/drivers/mmc/host/mxs-mmc.c
index 947581de7860..b043d53dd728 100644
--- a/drivers/mmc/host/mxs-mmc.c
+++ b/drivers/mmc/host/mxs-mmc.c
@@ -552,6 +552,13 @@ static const struct of_device_id mxs_mmc_dt_ids[] = {
};
MODULE_DEVICE_TABLE(of, mxs_mmc_dt_ids);

+static void regulator_disable_action(void *_data)
+{
+ struct regulator *regulator = _data;
+
+ regulator_disable(regulator);
+}
+
static int mxs_mmc_probe(struct platform_device *pdev)
{
struct device_node *np = pdev->dev.of_node;
@@ -591,6 +598,10 @@ 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,
+ regulator_disable_action, reg_vmmc);
+ if (ret)
+ goto out_mmc_free;
}

ssp->clk = devm_clk_get(&pdev->dev, NULL);
--
2.30.2
\
 
 \ /
  Last update: 2021-05-21 14:37    [W:0.059 / U:0.036 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site