Commit 5ac36d9c authored by Christian Lütke-Stetzkamp's avatar Christian Lütke-Stetzkamp Committed by Greg Kroah-Hartman

staging: mt7621-mmc: Fix memory leek in case of error in probe

If the base address is not successfully obtained in the probe
function, then the mmc_host struct is not freed. Adding an exit for
that case fixes the bug.
Signed-off-by: default avatarChristian Lütke-Stetzkamp <christian@lkamp.de>
Reviewed-by: default avatarNeilBrown <neil@brown.name>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 9673d9f6
......@@ -2719,8 +2719,10 @@ static int msdc_drv_probe(struct platform_device *pdev)
//BUG_ON((!hw) || (!mem) || (irq < 0)); /* --- by chhung */
base = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(base))
return PTR_ERR(base);
if (IS_ERR(base)) {
ret = PTR_ERR(base);
goto host_free;
}
/* Set host parameters to mmc */
mmc->ops = &mt_msdc_ops;
......@@ -2861,6 +2863,7 @@ static int msdc_drv_probe(struct platform_device *pdev)
if (mem)
release_mem_region(mem->start, mem->end - mem->start + 1);
host_free:
mmc_free_host(mmc);
return ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment