]> www.infradead.org Git - mtd-utils.git/commitdiff
mtd: tests: Fix check on ebcnt in nandpagetest
authorPaul HENRYS <paul.henrys@embconsulting.eu>
Wed, 22 Nov 2017 08:11:43 +0000 (09:11 +0100)
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>
Wed, 22 Nov 2017 11:44:52 +0000 (12:44 +0100)
If the number of erase blocks to use is not specified, ebcnt originally
set to -1 leads the program to exit with:
  "Cannot run with less than two blocks."

If the number of erase blocks to use is not specified and thus ebcnt is
equal to -1, the expected behaviour is to perform the test on all the
erase blocks of the mtd partition.

This fixes the change introduced in
4458ad6481f60d9884925d5bc62a7954880d181b.

Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
tests/mtd-tests/nandpagetest.c

index 2b16cc928eae155a5564135afc33cd40d780b83b..c6812df21e2abb51ef186785b7cfebd70cf354f0 100644 (file)
@@ -143,7 +143,7 @@ static void process_options(int argc, char **argv)
 
        if (optind < argc)
                usage(EXIT_FAILURE);
-       if (ebcnt < 2)
+       if (ebcnt >= 0 && ebcnt < 2)
                errmsg_die("Cannot run with less than two blocks.");
        if (peb < 0)
                peb = 0;