From: Zheng Liang <zhenglia...@huawei.com>

[ Upstream commit bbba85fae44134e00c493705bd5604fd63958315 ]

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

Reported-by: Hulk Robot <hul...@huawei.com>
Signed-off-by: Zheng Liang <zhenglia...@huawei.com>
Reviewed-by: Chaotian Jing <chaotian.j...@mediatek.com>
Link: https://lore.kernel.org/r/20201112092530.32446-1-zhenglia...@huawei.com
Signed-off-by: Ulf Hansson <ulf.hans...@linaro.org>
Signed-off-by: Sasha Levin <sas...@kernel.org>
---
 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