提交 cc56f133 编写于 作者: M Marek Vasut 提交者: Jagannadha Sutradharudu Teki

sf: Squash the malloc+memset combo

Squash the malloc()+memset() combo in favor of calloc().
Signed-off-by: NMarek Vasut <marex@denx.de>
Reviewed-by: NJagannadha Sutradharudu Teki <jaganna@xilinx.com>
上级 cfa90a63
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册