mmc: free allocated memory on initialization errors
Cleanup to balance malloc/free calls. Signed-off-by: Darwin Rambo <drambo@broadcom.com> Reviewed-by: Steve Rae <srae@broadcom.com> Acked-by: Pantelis Antoniou <panto@antoniou-consulting.com>
This commit is contained in:
parent
a5710920b7
commit
3d6a5a4dfc
|
|
@ -113,16 +113,20 @@ int kona_sdhci_init(int dev_index, u32 min_clk, u32 quirks)
|
||||||
__func__, dev_index);
|
__func__, dev_index);
|
||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
}
|
}
|
||||||
if (ret)
|
if (ret) {
|
||||||
|
free(host);
|
||||||
return ret;
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
host->name = "kona-sdhci";
|
host->name = "kona-sdhci";
|
||||||
host->ioaddr = reg_base;
|
host->ioaddr = reg_base;
|
||||||
host->quirks = quirks;
|
host->quirks = quirks;
|
||||||
host->host_caps = MMC_MODE_HC;
|
host->host_caps = MMC_MODE_HC;
|
||||||
|
|
||||||
if (init_kona_mmc_core(host))
|
if (init_kona_mmc_core(host)) {
|
||||||
|
free(host);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
if (quirks & SDHCI_QUIRK_REG32_RW)
|
if (quirks & SDHCI_QUIRK_REG32_RW)
|
||||||
host->version = sdhci_readl(host, SDHCI_HOST_VERSION - 2) >> 16;
|
host->version = sdhci_readl(host, SDHCI_HOST_VERSION - 2) >> 16;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue