Takashi Iwai dbe694
From b3e1cf31154136da855f3cb6117c17eb0b6bcfb4 Mon Sep 17 00:00:00 2001
Takashi Iwai dbe694
From: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Takashi Iwai dbe694
Date: Sun, 7 Aug 2022 08:56:38 +0200
Takashi Iwai dbe694
Subject: [PATCH] mmc: meson-gx: Fix an error handling path in meson_mmc_probe()
Takashi Iwai dbe694
Git-commit: b3e1cf31154136da855f3cb6117c17eb0b6bcfb4
Takashi Iwai dbe694
Patch-mainline: v6.0-rc2
Takashi Iwai dbe694
References: git-fixes
Takashi Iwai dbe694
Takashi Iwai dbe694
The commit in Fixes has introduced a new error handling which should goto
Takashi Iwai dbe694
the existing error handling path.
Takashi Iwai dbe694
Otherwise some resources leak.
Takashi Iwai dbe694
Takashi Iwai dbe694
Fixes: 19c6beaa064c ("mmc: meson-gx: add device reset")
Takashi Iwai dbe694
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Takashi Iwai dbe694
Cc: stable@vger.kernel.org
Takashi Iwai dbe694
Link: https://lore.kernel.org/r/be4b863bacf323521ba3a02efdc4fca9cdedd1a6.1659855351.git.christophe.jaillet@wanadoo.fr
Takashi Iwai dbe694
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Takashi Iwai dbe694
Acked-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai dbe694
Takashi Iwai dbe694
---
Takashi Iwai dbe694
 drivers/mmc/host/meson-gx-mmc.c | 6 ++++--
Takashi Iwai dbe694
 1 file changed, 4 insertions(+), 2 deletions(-)
Takashi Iwai dbe694
Takashi Iwai dbe694
diff --git a/drivers/mmc/host/meson-gx-mmc.c b/drivers/mmc/host/meson-gx-mmc.c
Takashi Iwai dbe694
index 2f08d442e557..fc462995cf94 100644
Takashi Iwai dbe694
--- a/drivers/mmc/host/meson-gx-mmc.c
Takashi Iwai dbe694
+++ b/drivers/mmc/host/meson-gx-mmc.c
Takashi Iwai dbe694
@@ -1172,8 +1172,10 @@ static int meson_mmc_probe(struct platform_device *pdev)
Takashi Iwai dbe694
 	}
Takashi Iwai dbe694
 
Takashi Iwai dbe694
 	ret = device_reset_optional(&pdev->dev);
Takashi Iwai dbe694
-	if (ret)
Takashi Iwai dbe694
-		return dev_err_probe(&pdev->dev, ret, "device reset failed\n");
Takashi Iwai dbe694
+	if (ret) {
Takashi Iwai dbe694
+		dev_err_probe(&pdev->dev, ret, "device reset failed\n");
Takashi Iwai dbe694
+		goto free_host;
Takashi Iwai dbe694
+	}
Takashi Iwai dbe694
 
Takashi Iwai dbe694
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
Takashi Iwai dbe694
 	host->regs = devm_ioremap_resource(&pdev->dev, res);
Takashi Iwai dbe694
-- 
Takashi Iwai dbe694
2.35.3
Takashi Iwai dbe694