From: Hector Palacios <hector.palacios@digi.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 1/1] mtd: nand-base: fix bug writing 1 byte less than page size
Date: Mon, 18 Jul 2016 09:39:09 +0200 [thread overview]
Message-ID: <578C879D.1010703@digi.com> (raw)
In-Reply-To: <1468826329-4586-1-git-send-email-hector.palacios@digi.com>
On 07/18/2016 09:18 AM, Hector Palacios wrote:
> nand_do_write_ops() determines if it is writing a partial page with the
> formula:
> if (column || (writelen < mtd->writesize - 1))
>
> When 'writelen' is exactly 1 byte less than the NAND page size the formula
> equates to zero, so the code doesn't process it as a partial write, although
> it should.
> As a consequence the function remains in the while(1) loop with 'writelen'
> becoming 0xffffffff and iterating until the watchdog timeout triggers.
>
> To reproduce the issue on a NAND with 2K page (0x800):
> => nand erase.part <partition>
> => nand write $loadaddr <partition> 7ff
>
> Signed-off-by: Hector Palacios <hector.palacios@digi.com>
>
> https://jira.digi.com/browse/DUB-619
> ---
> drivers/mtd/nand/nand_base.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
> index c0e381ad2d15..cb15bb21e2f0 100644
> --- a/drivers/mtd/nand/nand_base.c
> +++ b/drivers/mtd/nand/nand_base.c
> @@ -2524,7 +2524,7 @@ static int nand_do_write_ops(struct mtd_info *mtd, loff_t to,
>
> WATCHDOG_RESET();
> /* Partial page write? */
> - if (unlikely(column || writelen < (mtd->writesize - 1))) {
> + if (unlikely(column || writelen < mtd->writesize)) {
> cached = 0;
> bytes = min_t(int, bytes - column, (int) writelen);
> chip->pagebuf = -1;
>
Please disregard. This patch was generated over U-Boot v2015.04.
I sent a corrected v2 patch.
--
Hector Palacios
prev parent reply other threads:[~2016-07-18 7:39 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-18 7:18 [U-Boot] [PATCH 1/1] mtd: nand-base: fix bug writing 1 byte less than page size Hector Palacios
2016-07-18 7:39 ` Hector Palacios [this message]
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=578C879D.1010703@digi.com \
--to=hector.palacios@digi.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