diff options
author | Darwin Rambo <drambo@broadcom.com> | 2014-05-26 13:31:12 -0700 |
---|---|---|
committer | Pantelis Antoniou <panto@antoniou-consulting.com> | 2014-06-12 15:21:12 +0300 |
commit | 3d6a5a4dfca25a202e356e4d63e89cdc6bd7255a (patch) | |
tree | 38647d9ea7beb46987e5f0f01a5fb54be2b37977 | |
parent | a5710920b7b0016c6d83897d251b44922f5ca832 (diff) | |
download | u-boot-imx-3d6a5a4dfca25a202e356e4d63e89cdc6bd7255a.zip u-boot-imx-3d6a5a4dfca25a202e356e4d63e89cdc6bd7255a.tar.gz u-boot-imx-3d6a5a4dfca25a202e356e4d63e89cdc6bd7255a.tar.bz2 |
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>
-rw-r--r-- | drivers/mmc/kona_sdhci.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/mmc/kona_sdhci.c b/drivers/mmc/kona_sdhci.c index 77e42c8..f804f4c 100644 --- a/drivers/mmc/kona_sdhci.c +++ b/drivers/mmc/kona_sdhci.c @@ -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; |