sf: Squash the malloc+memset combo

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>
This commit is contained in:
Marek Vasut 2014-01-15 15:17:54 +01:00 committed by Jagannadha Sutradharudu Teki
parent cfa90a636b
commit cc56f13392

View 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;