]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
mmc: sdhci: Fix ADMA page boundary warnings
authorAdrian Hunter <adrian.hunter@intel.com>
Tue, 4 Nov 2014 10:42:36 +0000 (12:42 +0200)
committerUlf Hansson <ulf.hansson@linaro.org>
Mon, 10 Nov 2014 11:40:49 +0000 (12:40 +0100)
Bytes are being copied from/to a single page.  The intent
of the warning is to warn if the page boundary is crossed.
There are two problems.  First, PAGE_MASK is mistaken for
(PAGE_SIZE - 1).  Secondly, instead of using the number
of bytes to copy, the warning is using the maximum that
that value could be.  Fix both.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
drivers/mmc/host/sdhci.c

index 41c6d3b9766ccc7e8a02959ee9600acc6e2e157b..e7593578d5b2318e79a37b52e6638296e0911fcd 100644 (file)
@@ -525,7 +525,8 @@ static int sdhci_adma_table_pre(struct sdhci_host *host,
                if (offset) {
                        if (data->flags & MMC_DATA_WRITE) {
                                buffer = sdhci_kmap_atomic(sg, &flags);
-                               WARN_ON(((long)buffer & PAGE_MASK) > (PAGE_SIZE - 3));
+                               WARN_ON(((long)buffer & (PAGE_SIZE - 1)) >
+                                       (PAGE_SIZE - offset));
                                memcpy(align, buffer, offset);
                                sdhci_kunmap_atomic(buffer, &flags);
                        }
@@ -630,7 +631,8 @@ static void sdhci_adma_table_post(struct sdhci_host *host,
                                size = 4 - (sg_dma_address(sg) & 0x3);
 
                                buffer = sdhci_kmap_atomic(sg, &flags);
-                               WARN_ON(((long)buffer & PAGE_MASK) > (PAGE_SIZE - 3));
+                               WARN_ON(((long)buffer & (PAGE_SIZE - 1)) >
+                                       (PAGE_SIZE - size));
                                memcpy(buffer, align, size);
                                sdhci_kunmap_atomic(buffer, &flags);