* [PATCH 1/1] mtd: dataflash: fix spi_transfer init
@ 2012-11-01 9:16
2012-11-02 8:57 ` Sascha Hauer
0 siblings, 1 reply; 2+ messages in thread
From: @ 2012-11-01 9:16 UTC (permalink / raw)
To: barebox
From: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
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>
---
drivers/mtd/devices/mtd_dataflash.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/mtd/devices/mtd_dataflash.c b/drivers/mtd/devices/mtd_dataflash.c
index cbed15b..3b7b9c6 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);
--
1.7.10.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH 1/1] mtd: dataflash: fix spi_transfer init
2012-11-01 9:16 [PATCH 1/1] mtd: dataflash: fix spi_transfer init
@ 2012-11-02 8:57 ` Sascha Hauer
0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2012-11-02 8:57 UTC (permalink / raw)
To: barebox
On Thu, Nov 01, 2012 at 10:16:55AM +0100, wrote:
> From: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
>
> 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>
Applied, thanks
Sascha
> ---
> drivers/mtd/devices/mtd_dataflash.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/drivers/mtd/devices/mtd_dataflash.c b/drivers/mtd/devices/mtd_dataflash.c
> index cbed15b..3b7b9c6 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);
> --
> 1.7.10.4
>
>
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
>
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-11-02 8:57 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-01 9:16 [PATCH 1/1] mtd: dataflash: fix spi_transfer init
2012-11-02 8:57 ` Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox