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>
master
Marek Vasut 11 years ago committed by Jagannadha Sutradharudu Teki
parent cfa90a636b
commit cc56f13392
  1. 3
      drivers/mtd/spi/sf_probe.c

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

Loading…
Cancel
Save