ARM: mmci: round down the bytes transferred on error

We should not report incomplete blocks on error. Return the number of
bytes successfully transferred, rounded down to the nearest block.

Acked-by: Linus Walleij <linus.walleij@stericsson.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>

+4 -3
+4 -3
drivers/mmc/host/mmci.c
··· 14 14 #include <linux/ioport.h> 15 15 #include <linux/device.h> 16 16 #include <linux/interrupt.h> 17 + #include <linux/kernel.h> 17 18 #include <linux/delay.h> 18 19 #include <linux/err.h> 19 20 #include <linux/highmem.h> ··· 290 289 dev_dbg(mmc_dev(host->mmc), "MCI ERROR IRQ (status %08x)\n", status); 291 290 if (status & MCI_DATACRCFAIL) { 292 291 /* Last block was not successful */ 293 - host->data_xfered = ((success - 1) / data->blksz) * data->blksz; 292 + host->data_xfered = round_down(success - 1, data->blksz); 294 293 data->error = -EILSEQ; 295 294 } else if (status & MCI_DATATIMEOUT) { 296 - host->data_xfered = success; 295 + host->data_xfered = round_down(success, data->blksz); 297 296 data->error = -ETIMEDOUT; 298 297 } else if (status & (MCI_TXUNDERRUN|MCI_RXOVERRUN)) { 299 - host->data_xfered = success; 298 + host->data_xfered = round_down(success, data->blksz); 300 299 data->error = -EIO; 301 300 } 302 301