From 613b152c63e35095a929f9bb80441cbe91ff5e80 Mon Sep 17 00:00:00 2001 From: Russell King Date: Sun, 30 Jan 2011 21:06:53 +0000 Subject: [PATCH] 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 Signed-off-by: Russell King --- drivers/mmc/host/mmci.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c index 175a623a6a29..2d6de3e03e2d 100644 --- a/drivers/mmc/host/mmci.c +++ b/drivers/mmc/host/mmci.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -289,13 +290,13 @@ mmci_data_irq(struct mmci_host *host, struct mmc_data *data, dev_dbg(mmc_dev(host->mmc), "MCI ERROR IRQ (status %08x)\n", status); if (status & MCI_DATACRCFAIL) { /* Last block was not successful */ - host->data_xfered = ((success - 1) / data->blksz) * data->blksz; + host->data_xfered = round_down(success - 1, data->blksz); data->error = -EILSEQ; } else if (status & MCI_DATATIMEOUT) { - host->data_xfered = success; + host->data_xfered = round_down(success, data->blksz); data->error = -ETIMEDOUT; } else if (status & (MCI_TXUNDERRUN|MCI_RXOVERRUN)) { - host->data_xfered = success; + host->data_xfered = round_down(success, data->blksz); data->error = -EIO; } -- 2.30.2