summaryrefslogtreecommitdiff
path: root/drivers/mmc
diff options
context:
space:
mode:
authorFabio Estevam <fabio.estevam@freescale.com>2013-09-12 10:35:52 -0300
committerStefano Babic <sbabic@denx.de>2013-09-20 17:55:36 +0200
commit3f786a8b6f586cb19925e2e9cc45fd0dacf40356 (patch)
treeecba95ba0916d8a83babf430dfb7cd46ddb93561 /drivers/mmc
parent59f46f4a73b13dc500e6cdb13b507f2aa3bc8c45 (diff)
downloadu-boot-imx-3f786a8b6f586cb19925e2e9cc45fd0dacf40356.zip
u-boot-imx-3f786a8b6f586cb19925e2e9cc45fd0dacf40356.tar.gz
u-boot-imx-3f786a8b6f586cb19925e2e9cc45fd0dacf40356.tar.bz2
mmc: fsl_esdhc: Check the result from malloc()
malloc can fail, so we should better check its return value before using it. Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Diffstat (limited to 'drivers/mmc')
-rw-r--r--drivers/mmc/fsl_esdhc.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/mmc/fsl_esdhc.c b/drivers/mmc/fsl_esdhc.c
index f87e647..a7170b4 100644
--- a/drivers/mmc/fsl_esdhc.c
+++ b/drivers/mmc/fsl_esdhc.c
@@ -518,6 +518,8 @@ int fsl_esdhc_initialize(bd_t *bis, struct fsl_esdhc_cfg *cfg)
return -1;
mmc = malloc(sizeof(struct mmc));
+ if (!mmc)
+ return -ENOMEM;
sprintf(mmc->name, "FSL_SDHC");
regs = (struct fsl_esdhc *)cfg->esdhc_base;