diff mbox series

mtd: rawnand: brcmnand: fix bch ecc layout for large page nand

Message ID 1556306615-37990-1-git-send-email-kdasu.kdev@gmail.com
State Superseded
Delegated to: Miquel Raynal
Headers show
Series mtd: rawnand: brcmnand: fix bch ecc layout for large page nand | expand

Commit Message

Kamal Dasu April 26, 2019, 7:22 p.m. UTC
The oobregion->offset for large page nand parts was wrong, change
fixes this error in calculation.

Signed-off-by: Kamal Dasu <kdasu.kdev@gmail.com>
---
 drivers/mtd/nand/raw/brcmnand/brcmnand.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Florian Fainelli May 1, 2019, 6:35 p.m. UTC | #1
On 4/26/19 12:22 PM, Kamal Dasu wrote:
> The oobregion->offset for large page nand parts was wrong, change
> fixes this error in calculation.

Should this have a Fixes tag so this can be backported to stable trees
seemingly automatically? Thanks!

> 
> Signed-off-by: Kamal Dasu <kdasu.kdev@gmail.com>
> ---
>  drivers/mtd/nand/raw/brcmnand/brcmnand.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/mtd/nand/raw/brcmnand/brcmnand.c b/drivers/mtd/nand/raw/brcmnand/brcmnand.c
> index 482c6f0..3eefea7 100644
> --- a/drivers/mtd/nand/raw/brcmnand/brcmnand.c
> +++ b/drivers/mtd/nand/raw/brcmnand/brcmnand.c
> @@ -939,7 +939,7 @@ static int brcmnand_bch_ooblayout_ecc(struct mtd_info *mtd, int section,
>  	if (section >= sectors)
>  		return -ERANGE;
>  
> -	oobregion->offset = (section * (sas + 1)) - chip->ecc.bytes;
> +	oobregion->offset = ((section + 1) * sas) - chip->ecc.bytes;
>  	oobregion->length = chip->ecc.bytes;
>  
>  	return 0;
>
Kamal Dasu May 1, 2019, 7:15 p.m. UTC | #2
On Wed, May 1, 2019 at 2:35 PM Florian Fainelli <f.fainelli@gmail.com> wrote:
>
> On 4/26/19 12:22 PM, Kamal Dasu wrote:
> > The oobregion->offset for large page nand parts was wrong, change
> > fixes this error in calculation.
>
> Should this have a Fixes tag so this can be backported to stable trees
> seemingly automatically? Thanks!
>

The brcmnand files got moved, however should have the fixes tag, will
send V2 patch.

> >
> > Signed-off-by: Kamal Dasu <kdasu.kdev@gmail.com>
> > ---
> >  drivers/mtd/nand/raw/brcmnand/brcmnand.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/mtd/nand/raw/brcmnand/brcmnand.c b/drivers/mtd/nand/raw/brcmnand/brcmnand.c
> > index 482c6f0..3eefea7 100644
> > --- a/drivers/mtd/nand/raw/brcmnand/brcmnand.c
> > +++ b/drivers/mtd/nand/raw/brcmnand/brcmnand.c
> > @@ -939,7 +939,7 @@ static int brcmnand_bch_ooblayout_ecc(struct mtd_info *mtd, int section,
> >       if (section >= sectors)
> >               return -ERANGE;
> >
> > -     oobregion->offset = (section * (sas + 1)) - chip->ecc.bytes;
> > +     oobregion->offset = ((section + 1) * sas) - chip->ecc.bytes;
> >       oobregion->length = chip->ecc.bytes;
> >
> >       return 0;
> >
>
>
> --
> Florian
diff mbox series

Patch

diff --git a/drivers/mtd/nand/raw/brcmnand/brcmnand.c b/drivers/mtd/nand/raw/brcmnand/brcmnand.c
index 482c6f0..3eefea7 100644
--- a/drivers/mtd/nand/raw/brcmnand/brcmnand.c
+++ b/drivers/mtd/nand/raw/brcmnand/brcmnand.c
@@ -939,7 +939,7 @@  static int brcmnand_bch_ooblayout_ecc(struct mtd_info *mtd, int section,
 	if (section >= sectors)
 		return -ERANGE;
 
-	oobregion->offset = (section * (sas + 1)) - chip->ecc.bytes;
+	oobregion->offset = ((section + 1) * sas) - chip->ecc.bytes;
 	oobregion->length = chip->ecc.bytes;
 
 	return 0;