From: Andrew Morton <akpm@linux-foundation.org>
To: dbrownell@users.sourceforge.net
Cc: david-b@pacbell.net, linux-mtd@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: Re: [patch/RESEND 2.6.29-rc6] NAND: fix "raw" reads with ECC syndrome layouts
Date: Thu, 26 Feb 2009 12:25:43 -0800 [thread overview]
Message-ID: <20090226122543.797eac77.akpm@linux-foundation.org> (raw)
In-Reply-To: <200902241508.13835.david-b@pacbell.net>
On Tue, 24 Feb 2009 15:08:13 -0800
David Brownell <david-b@pacbell.net> wrote:
> +static void nand_write_page_raw_syndrome(struct mtd_info *mtd, struct nand_chip *chip,
> + const uint8_t *buf)
> +{
> + int eccsize = chip->ecc.size;
> + int eccbytes = chip->ecc.bytes;
> + uint8_t *oob = chip->oob_poi;
> + int temp;
Please don't create variables called "temp" or "tmp".
> + temp = chip->ecc.steps;
> + do {
> + chip->write_buf(mtd, buf, eccsize);
> + buf += eccsize;
> +
> + if (chip->ecc.prepad) {
> + chip->write_buf(mtd, oob, chip->ecc.prepad);
> + oob += chip->ecc.prepad;
> + }
> +
> + chip->read_buf(mtd, oob, eccbytes);
> + oob += eccbytes;
> +
> + if (chip->ecc.postpad) {
> + chip->write_buf(mtd, oob, chip->ecc.postpad);
> + oob += chip->ecc.postpad;
> + }
> + } while (--temp);
It would be clearer to code this as a plain old up-counting for loop.
> + temp = mtd->oobsize - (oob - chip->oob_poi);
> + if (temp)
> + chip->write_buf(mtd, oob, temp);
Here the same woefully-named variable appears to be reemployed for some
semantically quite different purpose.
> +}
next prev parent reply other threads:[~2009-02-26 20:25 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-02-24 23:08 [patch/RESEND 2.6.29-rc6] NAND: fix "raw" reads with ECC syndrome layouts David Brownell
2009-02-26 20:25 ` Andrew Morton [this message]
2009-02-27 3:28 ` David Brownell
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=20090226122543.797eac77.akpm@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=david-b@pacbell.net \
--cc=dbrownell@users.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
/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