aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Norris <computersforpeace@gmail.com>2011-08-31 13:00:32 -0700
committerArtem Bityutskiy <artem.bityutskiy@intel.com>2011-09-11 16:00:40 +0300
commitbf01f2960ba82468b1b25f00e044fd0c3ee0770a (patch)
tree951b6c019f5386c3d07c9b989420bb7409ce45ca
parent8138a2273687f54c7e14316c10a91e0e515c919b (diff)
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 <computersforpeace@gmail.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
-rw-r--r--nandwrite.c5
1 files changed, 3 insertions, 2 deletions
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;
}