summaryrefslogtreecommitdiffstats
path: root/drivers/mtd/devices/mtd_dataflash.c
diff options
context:
space:
mode:
authorJean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>2012-11-01 10:16:55 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2012-11-02 09:57:08 +0100
commit0f9c76614a7f91b92cd76dd08cfca7d77bbe7000 (patch)
tree87a588eee0cf2f0a8f3773d735b1614a53c43fff /drivers/mtd/devices/mtd_dataflash.c
parentd486b620fa308e3bac36e075737e773afa6022df (diff)
downloadbarebox-0f9c76614a7f91b92cd76dd08cfca7d77bbe7000.tar.gz
barebox-0f9c76614a7f91b92cd76dd08cfca7d77bbe7000.tar.xz
mtd: dataflash: fix spi_transfer init
on some system as the spi_transfer is not set to 0 if the rx_buf or tx_buf are not used they are not set to NULL Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/mtd/devices/mtd_dataflash.c')
-rw-r--r--drivers/mtd/devices/mtd_dataflash.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/mtd/devices/mtd_dataflash.c b/drivers/mtd/devices/mtd_dataflash.c
index cbed15b374..3b7b9c6bdc 100644
--- a/drivers/mtd/devices/mtd_dataflash.c
+++ b/drivers/mtd/devices/mtd_dataflash.c
@@ -161,6 +161,8 @@ static int dataflash_erase(struct mtd_info *mtd, struct erase_info *instr)
spi_message_init(&msg);
+ memset(&x, 0, sizeof(x));
+
x.tx_buf = command = priv->command;
x.len = 4;
spi_message_add_tail(&x, &msg);
@@ -246,6 +248,8 @@ static int dataflash_read(struct mtd_info *mtd, loff_t from, size_t len,
spi_message_init(&msg);
+ memset(&x[0], 0, sizeof(struct spi_transfer) * 2);
+
x[0].tx_buf = command;
x[0].len = 8;
spi_message_add_tail(&x[0], &msg);
@@ -302,6 +306,8 @@ static int dataflash_write(struct mtd_info *mtd, loff_t to, size_t len,
spi_message_init(&msg);
+ memset(&x[0], 0, sizeof(struct spi_transfer) * 2);
+
x[0].tx_buf = command = priv->command;
x[0].len = 4;
spi_message_add_tail(&x[0], &msg);