Browse Source

mxs/spi: Increment the transfer length only if transfer succeeded

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>
Marek Vasut 13 years ago
parent
commit
204e706fa2
1 changed files with 1 additions and 1 deletions
  1. 1 1
      drivers/spi/spi-mxs.c

+ 1 - 1
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;
 	}