mmc: fsl_esdhc: Check the result from malloc()
PATCH 1/1 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 <[email protected]>
--- drivers/mmc/fsl_esdhc.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/mmc/fsl_esdhc.c +2 -0
@@ -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;
Signature · 1 line
1.8.1.2
PATCH 1/1 mmc: fsl_esdhc: Check the result from malloc()
Quoted 4 lines · Fabio Estevam
malloc can fail, so we should better check its return value before using it.
Signed-off-by Fabio Estevam <[email protected]>---
Applied to u-boot-imx, thanks!
Best regards,
Stefano Babic
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de =====================================================================