From 3f786a8b6f586cb19925e2e9cc45fd0dacf40356 Mon Sep 17 00:00:00 2001 From: Fabio Estevam Date: Thu, 12 Sep 2013 10:35:52 -0300 Subject: [PATCH] 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 --- drivers/mmc/fsl_esdhc.c | 2 ++ 1 file changed, 2 insertions(+) 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; -- 2.25.1