]> www.infradead.org Git - mtd-utils.git/commitdiff
nanddump: always check the first erase block
authorBaruch Siach <baruch@tkos.co.il>
Tue, 12 Oct 2010 08:23:55 +0000 (10:23 +0200)
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
Sat, 16 Oct 2010 19:10:30 +0000 (22:10 +0300)
Check the first block even when start_addr is not eraseblock aligned.

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
nanddump.c

index b7341a5f3272c4d52fb148d4aecc0101ffa3a3a8..396c8ca746f55b4f38d70b7bab98227618eaf65e 100644 (file)
@@ -283,7 +283,7 @@ int main(int argc, char * const argv[])
        struct mtd_oob_buf oob = {0, 16, oobbuf};
        mtd_info_t meminfo;
        char pretty_buf[PRETTY_BUF_LEN];
-       int oobinfochanged = 0 ;
+       int oobinfochanged = 0, firstblock = 1;
        struct nand_oobinfo old_oobinfo;
        struct mtd_ecc_stats stat1, stat2;
        bool eccstats = false;
@@ -399,8 +399,10 @@ int main(int argc, char * const argv[])
                // new eraseblock , check for bad block
                if (noskipbad) {
                        badblock = 0;
-               } else if (blockstart != (ofs & (~meminfo.erasesize + 1))) {
+               } else if (blockstart != (ofs & (~meminfo.erasesize + 1)) ||
+                               firstblock) {
                        blockstart = ofs & (~meminfo.erasesize + 1);
+                       firstblock = 0;
                        if ((badblock = ioctl(fd, MEMGETBADBLOCK, &blockstart)) < 0) {
                                perror("ioctl(MEMGETBADBLOCK)");
                                goto closeall;