From: Fabio Estevam Date: Thu, 12 Sep 2013 13:35:52 +0000 (-0300) Subject: mmc: fsl_esdhc: Check the result from malloc() X-Git-Url: http://git.dujemihanovic.xyz/?a=commitdiff_plain;h=3f786a8b6f586cb19925e2e9cc45fd0dacf40356;p=u-boot.git 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 --- 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;