Message ID | 1581328530-29966-2-git-send-email-piotrs@cadence.com |
---|---|
State | Accepted |
Headers | show |
Series | [1/4] mtd: rawnand: cadence: get meta data size from registers | expand |
Hi Piotr, Piotr Sroka <piotrs@cadence.com> wrote on Mon, 10 Feb 2020 10:55:26 +0100: There is a typo in the title (available). > Previously ecc_sector size was used for calculation but its value > was not yet known. Can we rework a little bit this? What about: The value of cdns_chip->sector_count is not known at the moment of the derivation of ecc_size, leading to a zero value. Fix this by assigning ecc_size later in the code. Also, I think it deserves a Fixes/Cc:stable tag! > > Signed-off-by: Piotr Sroka <piotrs@cadence.com> > --- > drivers/mtd/nand/raw/cadence-nand-controller.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/mtd/nand/raw/cadence-nand-controller.c b/drivers/mtd/nand/raw/cadence-nand-controller.c > index 5063a8b493a4..2ebfd0934739 100644 > --- a/drivers/mtd/nand/raw/cadence-nand-controller.c > +++ b/drivers/mtd/nand/raw/cadence-nand-controller.c > @@ -2595,7 +2595,7 @@ int cadence_nand_attach_chip(struct nand_chip *chip) > { > struct cdns_nand_ctrl *cdns_ctrl = to_cdns_nand_ctrl(chip->controller); > struct cdns_nand_chip *cdns_chip = to_cdns_nand_chip(chip); > - u32 ecc_size = cdns_chip->sector_count * chip->ecc.bytes; > + u32 ecc_size; > struct mtd_info *mtd = nand_to_mtd(chip); > int ret; > > @@ -2634,6 +2634,7 @@ int cadence_nand_attach_chip(struct nand_chip *chip) > /* Error correction configuration. */ > cdns_chip->sector_size = chip->ecc.size; > cdns_chip->sector_count = mtd->writesize / cdns_chip->sector_size; > + ecc_size = cdns_chip->sector_count * chip->ecc.bytes; > > cdns_chip->avail_oob_size = mtd->oobsize - ecc_size; > Thanks, Miquèl
On Mon, 2020-02-10 at 09:55:26 UTC, Piotr Sroka wrote: > Previously ecc_sector size was used for calculation but its value > was not yet known. > > Signed-off-by: Piotr Sroka <piotrs@cadence.com> Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git nand/next, thanks. Miquel
Hi Piotr, Miquel Raynal <miquel.raynal@bootlin.com> wrote on Tue, 10 Mar 2020 19:29:51 +0100: > On Mon, 2020-02-10 at 09:55:26 UTC, Piotr Sroka wrote: > > Previously ecc_sector size was used for calculation but its value > > was not yet known. > > > > Signed-off-by: Piotr Sroka <piotrs@cadence.com> > > Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git nand/next, thanks. > I applied patch 2, 3 and 4 after having changed the commit message as suggested and with the Fixes/Cc: stable tags added. Thanks, Miquèl
diff --git a/drivers/mtd/nand/raw/cadence-nand-controller.c b/drivers/mtd/nand/raw/cadence-nand-controller.c index 5063a8b493a4..2ebfd0934739 100644 --- a/drivers/mtd/nand/raw/cadence-nand-controller.c +++ b/drivers/mtd/nand/raw/cadence-nand-controller.c @@ -2595,7 +2595,7 @@ int cadence_nand_attach_chip(struct nand_chip *chip) { struct cdns_nand_ctrl *cdns_ctrl = to_cdns_nand_ctrl(chip->controller); struct cdns_nand_chip *cdns_chip = to_cdns_nand_chip(chip); - u32 ecc_size = cdns_chip->sector_count * chip->ecc.bytes; + u32 ecc_size; struct mtd_info *mtd = nand_to_mtd(chip); int ret; @@ -2634,6 +2634,7 @@ int cadence_nand_attach_chip(struct nand_chip *chip) /* Error correction configuration. */ cdns_chip->sector_size = chip->ecc.size; cdns_chip->sector_count = mtd->writesize / cdns_chip->sector_size; + ecc_size = cdns_chip->sector_count * chip->ecc.bytes; cdns_chip->avail_oob_size = mtd->oobsize - ecc_size;
Previously ecc_sector size was used for calculation but its value was not yet known. Signed-off-by: Piotr Sroka <piotrs@cadence.com> --- drivers/mtd/nand/raw/cadence-nand-controller.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)