mmc: sdhci-of-at91: fix memleak on clk_get failure
[ Upstream commita04184ce77
] sdhci_alloc_host() does its work not using managed infrastructure, so needs explicit free on error path. Add it where needed. Cc: <stable@vger.kernel.org> Fixes:bb5f8ea4d5
("mmc: sdhci-of-at91: introduce driver for the Atmel SDMMC") Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl> Acked-by: Ludovic Desroches <ludovic.desroches@microchip.com> Acked-by: Adrian Hunter <adrian.hunter@intel.com> Link: https://lore.kernel.org/r/b2a44d5be2e06ff075f32477e466598bb0f07b36.1577961679.git.mirq-linux@rere.qmqm.pl Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
65e6f63ebf
commit
84c9efd2f8
|
@ -324,19 +324,22 @@ static int sdhci_at91_probe(struct platform_device *pdev)
|
||||||
priv->mainck = devm_clk_get(&pdev->dev, "baseclk");
|
priv->mainck = devm_clk_get(&pdev->dev, "baseclk");
|
||||||
if (IS_ERR(priv->mainck)) {
|
if (IS_ERR(priv->mainck)) {
|
||||||
dev_err(&pdev->dev, "failed to get baseclk\n");
|
dev_err(&pdev->dev, "failed to get baseclk\n");
|
||||||
return PTR_ERR(priv->mainck);
|
ret = PTR_ERR(priv->mainck);
|
||||||
|
goto sdhci_pltfm_free;
|
||||||
}
|
}
|
||||||
|
|
||||||
priv->hclock = devm_clk_get(&pdev->dev, "hclock");
|
priv->hclock = devm_clk_get(&pdev->dev, "hclock");
|
||||||
if (IS_ERR(priv->hclock)) {
|
if (IS_ERR(priv->hclock)) {
|
||||||
dev_err(&pdev->dev, "failed to get hclock\n");
|
dev_err(&pdev->dev, "failed to get hclock\n");
|
||||||
return PTR_ERR(priv->hclock);
|
ret = PTR_ERR(priv->hclock);
|
||||||
|
goto sdhci_pltfm_free;
|
||||||
}
|
}
|
||||||
|
|
||||||
priv->gck = devm_clk_get(&pdev->dev, "multclk");
|
priv->gck = devm_clk_get(&pdev->dev, "multclk");
|
||||||
if (IS_ERR(priv->gck)) {
|
if (IS_ERR(priv->gck)) {
|
||||||
dev_err(&pdev->dev, "failed to get multclk\n");
|
dev_err(&pdev->dev, "failed to get multclk\n");
|
||||||
return PTR_ERR(priv->gck);
|
ret = PTR_ERR(priv->gck);
|
||||||
|
goto sdhci_pltfm_free;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = sdhci_at91_set_clks_presets(&pdev->dev);
|
ret = sdhci_at91_set_clks_presets(&pdev->dev);
|
||||||
|
|
Loading…
Reference in New Issue