[PATCH 03/10] nandwrite: consolidate buffer usage
Brian Norris
computersforpeace at gmail.com
Wed Aug 31 16:00:32 EDT 2011
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 at gmail.com>
---
nandwrite.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/nandwrite.c b/nandwrite.c
index 3f70cb3..3eea6e2 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;
}
--
1.7.5.4
More information about the linux-mtd
mailing list