mxs/spi: Increment the transfer length only if transfer succeeded
authorMarek Vasut <marex@denx.de>
Tue, 4 Sep 2012 02:40:16 +0000 (04:40 +0200)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Wed, 5 Sep 2012 23:42:11 +0000 (07:42 +0800)
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 <marex@denx.de>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
drivers/spi/spi-mxs.c

index bcba098e97c5b2ae4b05d4386f7916f5d3b5f3a9..138c8523dbba51fa3a25f6cd05ef9b2bf118be42 100644 (file)
@@ -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;
        }