mmc: meson-gx: Fix an error handling path in meson_mmc_probe()
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Sun, 7 Aug 2022 06:56:38 +0000 (08:56 +0200)
committerUlf Hansson <ulf.hansson@linaro.org>
Mon, 15 Aug 2022 14:33:07 +0000 (16:33 +0200)
The commit in Fixes has introduced a new error handling which should goto
the existing error handling path.
Otherwise some resources leak.

Fixes: 19c6beaa064c ("mmc: meson-gx: add device reset")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/be4b863bacf323521ba3a02efdc4fca9cdedd1a6.1659855351.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
drivers/mmc/host/meson-gx-mmc.c

index 2f08d442e5577a9731601909aee7fcf239bb4917..fc462995cf94a40201d6dfab17bfeb03b9efcd21 100644 (file)
@@ -1172,8 +1172,10 @@ static int meson_mmc_probe(struct platform_device *pdev)
        }
 
        ret = device_reset_optional(&pdev->dev);
-       if (ret)
-               return dev_err_probe(&pdev->dev, ret, "device reset failed\n");
+       if (ret) {
+               dev_err_probe(&pdev->dev, ret, "device reset failed\n");
+               goto free_host;
+       }
 
        res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
        host->regs = devm_ioremap_resource(&pdev->dev, res);