From bf01f2960ba82468b1b25f00e044fd0c3ee0770a Mon Sep 17 00:00:00 2001 From: Brian Norris Date: Wed, 31 Aug 2011 13:00:32 -0700 Subject: 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 --- nandwrite.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'nandwrite.c') 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; } -- cgit v1.2.3