From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ilya Yanok Date: Mon, 12 Dec 2011 04:08:57 +0400 Subject: [U-Boot] [PATCH] nand_spl_simple: store ecc data on the stack In-Reply-To: <1323624146-8402-1-git-send-email-sbabic@denx.de> References: <1323624146-8402-1-git-send-email-sbabic@denx.de> Message-ID: <4EE54619.1070000@emcraft.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hi Stefano, thanks for posting this. There is a couple of comments below. On 11.12.2011 21:22, Stefano Babic wrote: > diff --git a/drivers/mtd/nand/nand_spl_simple.c b/drivers/mtd/nand/nand_spl_simple.c > index ed821f2..a3d1af0 100644 > --- a/drivers/mtd/nand/nand_spl_simple.c > +++ b/drivers/mtd/nand/nand_spl_simple.c > @@ -145,9 +145,9 @@ static int nand_is_bad_block(int block) > static int nand_read_page(int block, int page, uchar *dst) > { > struct nand_chip *this = mtd.priv; > - u_char *ecc_calc; > - u_char *ecc_code; > - u_char *oob_data; > + u_char ecc_calc[CONFIG_SYS_NAND_ECCSTEPS * CONFIG_SYS_NAND_ECCBYTES]; > + u_char ecc_code[CONFIG_SYS_NAND_ECCTOTAL]; Doesn't ECCTOTAL always equal to ECCSTEPS * ECCBYTES? > + u_char oob_data[CONFIG_SYS_NAND_OOBSIZE]; I think we can save a few bytes by placing ecc_code and oob_data into a union. We only need oob_data to get ecc_code... Regards, Ilya.