diff options
author | Fabio Estevam <fabio.estevam@freescale.com> | 2013-09-12 10:35:52 -0300 |
---|---|---|
committer | Stefano Babic <sbabic@denx.de> | 2013-09-20 17:55:36 +0200 |
commit | 3f786a8b6f586cb19925e2e9cc45fd0dacf40356 (patch) | |
tree | ecba95ba0916d8a83babf430dfb7cd46ddb93561 /drivers/mmc | |
parent | 59f46f4a73b13dc500e6cdb13b507f2aa3bc8c45 (diff) |
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.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/mmc/fsl_esdhc.c b/drivers/mmc/fsl_esdhc.c index f87e647881..a7170b49db 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; |