mirror of
https://source.denx.de/u-boot/u-boot.git
synced 2025-11-28 14:11:29 +01:00
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:
parent
cfa90a636b
commit
cc56f13392
@ -123,12 +123,11 @@ static struct spi_flash *spi_flash_validate_params(struct spi_slave *spi,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
flash = malloc(sizeof(*flash));
|
flash = calloc(1, sizeof(*flash));
|
||||||
if (!flash) {
|
if (!flash) {
|
||||||
debug("SF: Failed to allocate spi_flash\n");
|
debug("SF: Failed to allocate spi_flash\n");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
memset(flash, '\0', sizeof(*flash));
|
|
||||||
|
|
||||||
/* Assign spi data */
|
/* Assign spi data */
|
||||||
flash->spi = spi;
|
flash->spi = spi;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user