]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
mtd: gpmi-nand: fix read page when reading to vmalloced area
authorSascha Hauer <s.hauer@pengutronix.de>
Tue, 26 Jun 2012 15:26:16 +0000 (17:26 +0200)
committerLothar Waßmann <LW@KARO-electronics.de>
Fri, 24 May 2013 06:35:23 +0000 (08:35 +0200)
The gpmi-nand driver uses virt_addr_valid() to check whether a buffer
is suitable for dma. If it's not, a driver allocated buffer is used
instead. Then after a page read the driver allocated buffer must be
copied to the user supplied buffer. This does not happen since commit
7725cc85932bd02dd12c23108e0ef748c551ccba.

This patch fixes the issue. The bug is encountered with UBI which uses a
vmalloced buffer for the volume table.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Tested-by: snijsure@grid-net.com
Acked-by: Huang Shijie <b32955@freescale.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Signed-off-by: Huang Shijie <b32955@freescale.com>
drivers/mtd/nand/gpmi-nand/gpmi-nand.c

index e9e8d1c09ba52534d6f57b61f1fda29c19898f99..cc353ce5ae7e3b02041b5e9d9866faaf0a6f6b1d 100644 (file)
@@ -952,12 +952,12 @@ static int gpmi_ecc_read_page(struct mtd_info *mtd, struct nand_chip *chip,
                 */
                memset(chip->oob_poi, ~0, mtd->oobsize);
                chip->oob_poi[0] = ((uint8_t *) auxiliary_virt)[0];
-
-               read_page_swap_end(this, buf, mtd->writesize,
-                               this->payload_virt, this->payload_phys,
-                               nfc_geo->payload_size,
-                               payload_virt, payload_phys);
        }
+
+       read_page_swap_end(this, buf, mtd->writesize,
+                       this->payload_virt, this->payload_phys,
+                       nfc_geo->payload_size,
+                       payload_virt, payload_phys);
 exit_nfc:
        return ret;
 }