summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBoris Brezillon <boris.brezillon@bootlin.com>2018-10-28 12:29:55 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-11-21 09:19:19 +0100
commit9bec0c3da4802291661124656fbd7d458e81c198 (patch)
tree72af960e86ee800269860f862ef4efe6797931fa
parent9e9dd0f1c345ba9b4d3d409345aa362815785bf5 (diff)
downloadlinux-stable-9bec0c3da4802291661124656fbd7d458e81c198.tar.gz
linux-stable-9bec0c3da4802291661124656fbd7d458e81c198.tar.bz2
linux-stable-9bec0c3da4802291661124656fbd7d458e81c198.zip
mtd: nand: Fix nanddev_neraseblocks()
commit d098093ba06eb032057d1aca1c2e45889e099d00 upstream. 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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--include/linux/mtd/nand.h5
1 files changed, 2 insertions, 3 deletions
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
index abe975c87b90..78b86dea2f29 100644
--- a/include/linux/mtd/nand.h
+++ b/include/linux/mtd/nand.h
@@ -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;
}
/**