Skip to content
Snippets Groups Projects
Commit 3d6a5a4d authored by Darwin Rambo's avatar Darwin Rambo Committed by Pantelis Antoniou
Browse files

mmc: free allocated memory on initialization errors


Cleanup to balance malloc/free calls.

Signed-off-by: default avatarDarwin Rambo <drambo@broadcom.com>
Reviewed-by: default avatarSteve Rae <srae@broadcom.com>
Acked-by: default avatarPantelis Antoniou <panto@antoniou-consulting.com>
parent a5710920
No related branches found
No related tags found
No related merge requests found
......@@ -113,16 +113,20 @@ int kona_sdhci_init(int dev_index, u32 min_clk, u32 quirks)
__func__, dev_index);
ret = -EINVAL;
}
if (ret)
if (ret) {
free(host);
return ret;
}
host->name = "kona-sdhci";
host->ioaddr = reg_base;
host->quirks = quirks;
host->host_caps = MMC_MODE_HC;
if (init_kona_mmc_core(host))
if (init_kona_mmc_core(host)) {
free(host);
return -EINVAL;
}
if (quirks & SDHCI_QUIRK_REG32_RW)
host->version = sdhci_readl(host, SDHCI_HOST_VERSION - 2) >> 16;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment