[U-Boot] [PATCH 1/4] OneNAND: Move largepage_memorybased
Scott Wood
scottwood at freescale.com
Mon Oct 4 19:59:14 CEST 2010
On Sat, 2 Oct 2010 19:33:56 +0200
Marek Vasut <marek.vasut at 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 at 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.
What problem are you trying to solve?
-Scott
More information about the U-Boot
mailing list