From: Brian Norris Date: Wed, 31 Aug 2011 20:00:32 +0000 (-0700) Subject: nandwrite: consolidate buffer usage X-Git-Tag: v1.4.7~13 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=bf01f2960ba82468b1b25f00e044fd0c3ee0770a;p=mtd-utils.git nandwrite: consolidate buffer usage Instead of using two different output buffers for OOB data, let's just use the same one for all output. This adds an extra memcpy, but it simplifies some future work, so it's worth it. Signed-off-by: Brian Norris Signed-off-by: Artem Bityutskiy --- diff --git a/nandwrite.c b/nandwrite.c index 17a717c..066ef55 100644 --- a/nandwrite.c +++ b/nandwrite.c @@ -531,11 +531,12 @@ int main(int argc, char * const argv[]) oobreadbuf + start, len); } + } else { + memcpy(oobbuf, oobreadbuf, mtd.oob_size); } /* Write OOB data first, as ecc will be placed in there */ if (mtd_write_oob(mtd_desc, &mtd, fd, mtdoffset, - mtd.oob_size, - noecc ? oobreadbuf : oobbuf)) { + mtd.oob_size, oobbuf)) { sys_errmsg("%s: MTD writeoob failure", mtd_device); goto closeall; }