* [U-Boot] [PATCH] mmc: fsl_esdhc: Check the result from malloc()
@ 2013-09-12 13:35 Fabio Estevam
2013-09-20 16:04 ` Stefano Babic
0 siblings, 1 reply; 2+ messages in thread
From: Fabio Estevam @ 2013-09-12 13:35 UTC (permalink / raw)
To: u-boot
malloc can fail, so we should better check its return value before using it.
Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
---
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 f87e647..a7170b4 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;
--
1.8.1.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [U-Boot] [PATCH] mmc: fsl_esdhc: Check the result from malloc()
2013-09-12 13:35 [U-Boot] [PATCH] mmc: fsl_esdhc: Check the result from malloc() Fabio Estevam
@ 2013-09-20 16:04 ` Stefano Babic
0 siblings, 0 replies; 2+ messages in thread
From: Stefano Babic @ 2013-09-20 16:04 UTC (permalink / raw)
To: u-boot
On 12/09/2013 15:35, Fabio Estevam wrote:
> malloc can fail, so we should better check its return value before using it.
>
> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
> ---
Applied to u-boot-imx, thanks!
Best regards,
Stefano Babic
--
=====================================================================
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
=====================================================================
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-09-20 16:04 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-12 13:35 [U-Boot] [PATCH] mmc: fsl_esdhc: Check the result from malloc() Fabio Estevam
2013-09-20 16:04 ` Stefano Babic
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox