All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mtd: nand: Fix nanddev_neraseblocks()
@ 2018-10-28 11:29 Boris Brezillon
  2018-10-31 14:36 ` Miquel Raynal
  2018-11-05 22:57 ` Boris Brezillon
  0 siblings, 2 replies; 3+ messages in thread
From: Boris Brezillon @ 2018-10-28 11:29 UTC (permalink / raw)
  To: Boris Brezillon, Richard Weinberger, Miquel Raynal, linux-mtd
  Cc: David Woodhouse, Brian Norris, Marek Vasut, stable

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>
---
 include/linux/mtd/nand.h | 5 ++---
 1 file 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;
 }
 
 /**
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] mtd: nand: Fix nanddev_neraseblocks()
  2018-10-28 11:29 [PATCH] mtd: nand: Fix nanddev_neraseblocks() Boris Brezillon
@ 2018-10-31 14:36 ` Miquel Raynal
  2018-11-05 22:57 ` Boris Brezillon
  1 sibling, 0 replies; 3+ messages in thread
From: Miquel Raynal @ 2018-10-31 14:36 UTC (permalink / raw)
  To: Boris Brezillon
  Cc: Richard Weinberger, linux-mtd, David Woodhouse, Brian Norris,
	Marek Vasut, stable

Hi Boris,

Boris Brezillon <boris.brezillon@bootlin.com> wrote on Sun, 28 Oct 2018
12:29:55 +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>
> ---
>  include/linux/mtd/nand.h | 5 ++---
>  1 file 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;
>  }
>  
>  /**


Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>


Thanks,
Miquèl

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] mtd: nand: Fix nanddev_neraseblocks()
  2018-10-28 11:29 [PATCH] mtd: nand: Fix nanddev_neraseblocks() Boris Brezillon
  2018-10-31 14:36 ` Miquel Raynal
@ 2018-11-05 22:57 ` Boris Brezillon
  1 sibling, 0 replies; 3+ messages in thread
From: Boris Brezillon @ 2018-11-05 22:57 UTC (permalink / raw)
  To: Boris Brezillon, Richard Weinberger, Miquel Raynal, linux-mtd
  Cc: David Woodhouse, Brian Norris, Marek Vasut, stable

On Sun, 28 Oct 2018 12:29:55 +0100
Boris Brezillon <boris.brezillon@bootlin.com> wrote:

> 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>

Queued to the fixes branch.

> ---
>  include/linux/mtd/nand.h | 5 ++---
>  1 file 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;
>  }
>  
>  /**

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-11-06  8:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-28 11:29 [PATCH] mtd: nand: Fix nanddev_neraseblocks() Boris Brezillon
2018-10-31 14:36 ` Miquel Raynal
2018-11-05 22:57 ` Boris Brezillon

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.