]> err.no Git - linux-2.6/commitdiff
sdhci: be more cautious about block count register
authorPierre Ossman <drzeus@drzeus.cx>
Sun, 12 Aug 2007 11:13:24 +0000 (13:13 +0200)
committerPierre Ossman <drzeus@drzeus.cx>
Thu, 23 Aug 2007 04:27:44 +0000 (06:27 +0200)
The block count register shouldn't be trusted for single block transfers,
so avoid using it completely when calculating transferred bytes.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
drivers/mmc/host/sdhci.c

index f2bc87ac24f7fe9151dcc948ffedb921d798116c..7181e867863e8fda756cb7744ecf47c3bd306c09 100644 (file)
@@ -477,8 +477,8 @@ static void sdhci_finish_data(struct sdhci_host *host)
        /*
         * Controller doesn't count down when in single block mode.
         */
-       if ((data->blocks == 1) && (data->error == MMC_ERR_NONE))
-               blocks = 0;
+       if (data->blocks == 1)
+               blocks = (data->error == MMC_ERR_NONE) ? 0 : 1;
        else
                blocks = readw(host->ioaddr + SDHCI_BLOCK_COUNT);
        data->bytes_xfered = data->blksz * (data->blocks - blocks);