mtd: nand: Fix nanddev_neraseblocks()
authorBoris Brezillon <boris.brezillon@bootlin.com>
Sun, 28 Oct 2018 11:29:55 +0000 (12:29 +0100)
committerBoris Brezillon <boris.brezillon@bootlin.com>
Mon, 5 Nov 2018 08:23:47 +0000 (09:23 +0100)
nanddev_neraseblocks() currently returns the number pages per LUN
instead of the total number of eraseblocks.

Fixes: 9c3736a3de21 ("mtd: nand: Add core infrastructure to deal with NAND devices")
Cc: <stable@vger.kernel.org>
Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>
include/linux/mtd/nand.h

index abe975c87b9003a7301f0e879f6bdad733e6c583..78b86dea2f294a9dac85130966a41eae3cf07aa0 100644 (file)
@@ -324,9 +324,8 @@ static inline unsigned int nanddev_ntargets(const struct nand_device *nand)
  */
 static inline unsigned int nanddev_neraseblocks(const struct nand_device *nand)
 {
-       return (u64)nand->memorg.luns_per_target *
-              nand->memorg.eraseblocks_per_lun *
-              nand->memorg.pages_per_eraseblock;
+       return nand->memorg.ntargets * nand->memorg.luns_per_target *
+              nand->memorg.eraseblocks_per_lun;
 }
 
 /**