提交 3f786a8b 编写于 作者: F Fabio Estevam 提交者: Stefano Babic

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: NFabio Estevam <fabio.estevam@freescale.com>
上级 59f46f4a
...@@ -518,6 +518,8 @@ int fsl_esdhc_initialize(bd_t *bis, struct fsl_esdhc_cfg *cfg) ...@@ -518,6 +518,8 @@ int fsl_esdhc_initialize(bd_t *bis, struct fsl_esdhc_cfg *cfg)
return -1; return -1;
mmc = malloc(sizeof(struct mmc)); mmc = malloc(sizeof(struct mmc));
if (!mmc)
return -ENOMEM;
sprintf(mmc->name, "FSL_SDHC"); sprintf(mmc->name, "FSL_SDHC");
regs = (struct fsl_esdhc *)cfg->esdhc_base; regs = (struct fsl_esdhc *)cfg->esdhc_base;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册