[U-Boot] [PATCH 1/4] OneNAND: Move largepage_memorybased

Marek Vasut
2010-10-04T21:15:11Z

Dne Po 4. ??jna 2010 19:59:14 Scott Wood napsal(a):
> On Sat, 2 Oct 2010 19:33:56 +0200
>
> Marek Vasut <marek.vasut@gmail.com> wrote:
> > This moves "struct nand_bbt_descr largepage_memorybased" into
> > "onenand_default_bbt" as that's the only place where this is used.
> >
> > This also removes an entry from .data section. (For me, this section
> > disappears after relocation).
> >
> > Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
> > ---
> >
> > drivers/mtd/onenand/onenand_bbt.c | 25 ++++++++++++-------------
> > 1 files changed, 12 insertions(+), 13 deletions(-)
> >
> > diff --git a/drivers/mtd/onenand/onenand_bbt.c
> > b/drivers/mtd/onenand/onenand_bbt.c index 1354877..c5d3905 100644
> > --- a/drivers/mtd/onenand/onenand_bbt.c
> > +++ b/drivers/mtd/onenand/onenand_bbt.c
> > @@ -227,19 +227,6 @@ int onenand_scan_bbt(struct mtd_info *mtd, struct
> > nand_bbt_descr *bd)
> >
> > return ret;
> >
> > }
> >
> > -/*
> > - * Define some generic bad / good block scan pattern which are used
> > - * while scanning a device for factory marked good / bad blocks.
> > - */
> > -static uint8_t scan_ff_pattern[] = { 0xff, 0xff };
> > -
> > -static struct nand_bbt_descr largepage_memorybased = {
> > - .options = 0,
> > - .offs = 0,
> > - .len = 2,
> > - .pattern = scan_ff_pattern,
> > -};
> > -
> >
> > /**
> >
> > * onenand_default_bbt - [OneNAND Interface] Select a default bad block
> > table for the device * @param mtd MTD device structure
> >
> > @@ -252,6 +239,18 @@ int onenand_default_bbt(struct mtd_info *mtd)
> >
> > struct onenand_chip *this = mtd->priv;
> > struct bbm_info *bbm;
> >
> > + /*
> > + * Define some generic bad / good block scan pattern which are used
> > + * while scanning a device for factory marked good / bad blocks.
> > + */
> > + uint8_t scan_ff_pattern[] = { 0xff, 0xff };
> > + struct nand_bbt_descr largepage_memorybased = {
> > + .options = 0,
> > + .offs = 0,
> > + .len = 2,
> > + .pattern = scan_ff_pattern,
> > + };
> > +
> >
> > this->bbm = malloc(sizeof(struct bbm_info));
> > if (!this->bbm)
> >
> > return -ENOMEM;
>
> NACK, you're taking the address of stack data and using it after the
> stack frame goes away.
>
The .data section doesn't exist at 0x0 (where the stuff is linked) when this code
is executed in my case.

> What problem are you trying to solve?
>
> -Scott