summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarek Vasut <marex@denx.de>2014-01-15 15:17:54 +0100
committerJagannadha Sutradharudu Teki <jaganna@xilinx.com>2014-03-17 21:54:56 +0530
commitcc56f13392197d6195ec6df2569bec1ce4d7b9ce (patch)
tree0ae1e3b99c0ad2873ed284f144333e6e825d99b5
parentcfa90a636b74312c56e2cc1d307876fdcd6d687c (diff)
downloadu-boot-imx-cc56f13392197d6195ec6df2569bec1ce4d7b9ce.zip
u-boot-imx-cc56f13392197d6195ec6df2569bec1ce4d7b9ce.tar.gz
u-boot-imx-cc56f13392197d6195ec6df2569bec1ce4d7b9ce.tar.bz2
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>
-rw-r--r--drivers/mtd/spi/sf_probe.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/mtd/spi/sf_probe.c b/drivers/mtd/spi/sf_probe.c
index bc3cf6c..e84ab13 100644
--- a/drivers/mtd/spi/sf_probe.c
+++ b/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;