]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
sf: Squash the malloc+memset combo
authorMarek Vasut <marex@denx.de>
Wed, 15 Jan 2014 14:17:54 +0000 (15:17 +0100)
committerJagannadha Sutradharudu Teki <jaganna@xilinx.com>
Mon, 17 Mar 2014 16:24:56 +0000 (21:54 +0530)
Squash the malloc()+memset() combo in favor of calloc().

Signed-off-by: Marek Vasut <marex@denx.de>
Reviewed-by: Jagannadha Sutradharudu Teki <jaganna@xilinx.com>
drivers/mtd/spi/sf_probe.c

index bc3cf6cc64aaa3bb324e3a360882a78725552696..e84ab1363bd3a7aacee59d2bdcac694716e49d97 100644 (file)
@@ -123,12 +123,11 @@ static struct spi_flash *spi_flash_validate_params(struct spi_slave *spi,
                return NULL;
        }
 
-       flash = malloc(sizeof(*flash));
+       flash = calloc(1, sizeof(*flash));
        if (!flash) {
                debug("SF: Failed to allocate spi_flash\n");
                return NULL;
        }
-       memset(flash, '\0', sizeof(*flash));
 
        /* Assign spi data */
        flash->spi = spi;