The transfer function incremented (struct spi_message)->actual_length
unconditionally, even if the transfer failed. Rectify this by incrementing
this only if transfer succeeded.

Signed-off-by: Marek Vasut <ma...@denx.de>
Cc: Chris Ball <c...@laptop.org>
Cc: Fabio Estevam <fabio.este...@freescale.com>
Cc: Grant Likely <grant.lik...@secretlab.ca>
Cc: Mark Brown <broo...@opensource.wolfsonmicro.com>
Cc: Shawn Guo <shawn....@linaro.org>
---
 drivers/spi/spi-mxs.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/spi/spi-mxs.c b/drivers/spi/spi-mxs.c
index 3add52e..282bdd7 100644
--- a/drivers/spi/spi-mxs.c
+++ b/drivers/spi/spi-mxs.c
@@ -473,12 +473,12 @@ static int mxs_spi_transfer_one(struct spi_master *master,
                                                &first, &last, 0);
                }
 
-               m->actual_length += t->len;
                if (status) {
                        stmp_reset_block(ssp->base);
                        break;
                }
 
+               m->actual_length += t->len;
                first = last = 0;
        }
 
-- 
1.7.10.4


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
spi-devel-general mailing list
spi-devel-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/spi-devel-general

Reply via email to