public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Scott Wood <scottwood@freescale.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] Add Yaffs2 image writing support.
Date: Thu, 11 Mar 2010 17:14:14 -0600	[thread overview]
Message-ID: <4B997946.3080409@freescale.com> (raw)
In-Reply-To: <20100311224110.824B2E22AD1@gemini.denx.de>

Wolfgang Denk wrote:
> Dear Scott,
> 
> In message <1263145126-23165-1-git-send-email-liwenhao.g@gmail.com> Li Wenha wrote:
>> Signed-off-by: Li Wenhao <liwenhao.g@gmail.com>
>> ---
>>  common/cmd_nand.c |   21 +++++++++++++++++++++
>>  1 files changed, 21 insertions(+), 0 deletions(-)
>>
>> diff --git a/common/cmd_nand.c b/common/cmd_nand.c
>> index 075a8af..38c6480 100644
>> --- a/common/cmd_nand.c
>> +++ b/common/cmd_nand.c
>> @@ -390,6 +390,27 @@ int do_nand(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
>>  				ret = nand->read_oob(nand, off, &ops);
>>  			else
>>  				ret = nand->write_oob(nand, off, &ops);
>> +		} else if (!strcmp(s, ".yaffs2") && !read) {
>> +			mtd_oob_ops_t ops = {
>> +				.mode = MTD_OOB_AUTO,
>> +				.len = 2048,	/* page size */
>> +				.ooblen = 64,	/* spare size */
>> +			};

What about 512 or 4096 byte pages?

>> +
>> +			ulong page = 0;
>> +			ulong block_size = ops.len + ops.ooblen;
>> +			while (page * block_size < size) {

What if "size" is not a multiple of "block_size"?  Should not read past 
the end of the input array, and should warn the user.

>> +				ret = nand->write_oob(nand, 
>> +						      off + page * ops.len,
>> +						      &ops);
>> +
>> +				if (ret) break;

The break should go on its own line, and you should tell the user about 
the failure.

>> +
>> +				page++;
>> +			}
>>  		} else {
>>  			printf("Unknown nand command suffix '%s'.\n", s);
>>  			return 1;
>> -- 
>> 1.6.3.3
> 
> What is the status of this patch? Is it in your queue?

No, I didn't notice it -- the subject doesn't mention NAND, and it 
presumably wasn't CCed to me.

Li Wenhao, could you send a new patch addressing the above issues, plus 
updated documentation?

-Scott

  reply	other threads:[~2010-03-11 23:14 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-10 17:38 [U-Boot] [PATCH] Add Yaffs2 image writing support Li Wenhao
2010-03-11 22:41 ` Wolfgang Denk
2010-03-11 23:14   ` Scott Wood [this message]
2010-04-09 20:43 ` Wolfgang Denk
2010-04-10 12:27   ` Wenhao Li

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4B997946.3080409@freescale.com \
    --to=scottwood@freescale.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox