Dummy byte(s) are need to send followed by address opcode for read operation, and that dummy byte(s) not required to malloc as well memset.
Cc: Simon Glass <s...@chromium.org> Cc: Bin Meng <bmeng...@gmail.com> Cc: Mugunthan V N <mugunthan...@ti.com> Cc: Michal Simek <michal.si...@xilinx.com> Cc: Siva Durga Prasad Paladugu <siva...@xilinx.com> Signed-off-by: Jagan Teki <jt...@openedev.com> --- drivers/mtd/spi-nor/spi-nor.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c index befee67..97f5eaa 100644 --- a/drivers/mtd/spi-nor/spi-nor.c +++ b/drivers/mtd/spi-nor/spi-nor.c @@ -617,7 +617,7 @@ static int spi_nor_read(struct mtd_info *mtd, loff_t from, size_t len, { struct spi_nor *nor = mtd->priv; u32 remain_len, read_len, read_addr; - u8 *cmd, cmdsz; + u8 cmd[SNOR_MAX_CMD_SIZE], cmdsz; int bank_sel = 0; int ret = -1; @@ -633,12 +633,6 @@ static int spi_nor_read(struct mtd_info *mtd, loff_t from, size_t len, } cmdsz = SNOR_MAX_CMD_SIZE + nor->read_dummy; - cmd = calloc(1, cmdsz); - if (!cmd) { - debug("spi-nor: Failed to allocate cmd\n"); - return -ENOMEM; - } - cmd[0] = nor->read_opcode; while (len) { read_addr = from; @@ -672,7 +666,6 @@ static int spi_nor_read(struct mtd_info *mtd, loff_t from, size_t len, *retlen += read_len; } - free(cmd); return ret; } -- 1.9.1 _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot