mmc: fsl_esdhc: Use calloc()
authorFabio Estevam <fabio.estevam@freescale.com>
Thu, 27 Dec 2012 08:51:08 +0000 (08:51 +0000)
committerAndy Fleming <afleming@freescale.com>
Mon, 6 May 2013 21:26:25 +0000 (16:26 -0500)
A malloc() followed by memset() can be simply replaced by calloc().

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Andy Fleming <afleming@freescale.com>
drivers/mmc/fsl_esdhc.c

index e945c0a470ca85667026a422933e7669effcb6a2..ec01795f32c1bd47545461ca0bedce729d75d7f2 100644 (file)
@@ -601,8 +601,7 @@ int fsl_esdhc_mmc_init(bd_t *bis)
 {
        struct fsl_esdhc_cfg *cfg;
 
-       cfg = malloc(sizeof(struct fsl_esdhc_cfg));
-       memset(cfg, 0, sizeof(struct fsl_esdhc_cfg));
+       cfg = calloc(sizeof(struct fsl_esdhc_cfg), 1);
        cfg->esdhc_base = CONFIG_SYS_FSL_ESDHC_ADDR;
        cfg->sdhc_clk = gd->arch.sdhc_clk;
        return fsl_esdhc_initialize(bis, cfg);