]> www.infradead.org Git - mtd-utils.git/commitdiff
nandwrite: consolidate buffer usage
authorBrian Norris <computersforpeace@gmail.com>
Wed, 31 Aug 2011 20:00:32 +0000 (13:00 -0700)
committerArtem Bityutskiy <artem.bityutskiy@intel.com>
Sun, 11 Sep 2011 13:00:40 +0000 (16:00 +0300)
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>
nandwrite.c

index 17a717c9ff038edc780ad000b95ef05aed61482a..066ef5531e91b9bb0d16a66aedc0d687ad683810 100644 (file)
@@ -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;
                        }