Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mmc: mxs-mmc: disable regulator on error and in the remove function

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>
Link: https://lore.kernel.org/r/4aadb3c97835f7b80f00819c3d549e6130384e67.1634365151.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>

authored by

Christophe JAILLET and committed by
Ulf Hansson
ce5f6c2c a1e97bd2

+10
+10
drivers/mmc/host/mxs-mmc.c
··· 552 552 }; 553 553 MODULE_DEVICE_TABLE(of, mxs_mmc_dt_ids); 554 554 555 + static void mxs_mmc_regulator_disable(void *regulator) 556 + { 557 + regulator_disable(regulator); 558 + } 559 + 555 560 static int mxs_mmc_probe(struct platform_device *pdev) 556 561 { 557 562 struct device_node *np = pdev->dev.of_node; ··· 596 591 "Failed to enable vmmc regulator: %d\n", ret); 597 592 goto out_mmc_free; 598 593 } 594 + 595 + ret = devm_add_action_or_reset(&pdev->dev, mxs_mmc_regulator_disable, 596 + reg_vmmc); 597 + if (ret) 598 + goto out_mmc_free; 599 599 } 600 600 601 601 ssp->clk = devm_clk_get(&pdev->dev, NULL);