From: Zheng Liang <[email protected]>

[ Upstream commit bbba85fae44134e00c493705bd5604fd63958315 ]

It should use mmc_free_host to free mem in error patch of
msdc_drv_probe.

Reported-by: Hulk Robot <[email protected]>
Signed-off-by: Zheng Liang <[email protected]>
Reviewed-by: Chaotian Jing <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Ulf Hansson <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
---
 drivers/mmc/host/mtk-sd.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/host/mtk-sd.c b/drivers/mmc/host/mtk-sd.c
index 9d47a2bd2546b..3c11bd5a3b86c 100644
--- a/drivers/mmc/host/mtk-sd.c
+++ b/drivers/mmc/host/mtk-sd.c
@@ -2242,8 +2242,10 @@ static int msdc_drv_probe(struct platform_device *pdev)
 
        host->reset = devm_reset_control_get_optional_exclusive(&pdev->dev,
                                                                "hrst");
-       if (IS_ERR(host->reset))
-               return PTR_ERR(host->reset);
+       if (IS_ERR(host->reset)) {
+               ret = PTR_ERR(host->reset);
+               goto host_free;
+       }
 
        host->irq = platform_get_irq(pdev, 0);
        if (host->irq < 0) {
-- 
2.27.0

Reply via email to