mtd: tests: print correct values
authorRoman Tereshonkov <roman.tereshonkov@nokia.com>
Thu, 3 Feb 2011 11:45:56 +0000 (13:45 +0200)
committerDavid Woodhouse <David.Woodhouse@intel.com>
Fri, 11 Mar 2011 14:22:44 +0000 (14:22 +0000)
The ebcnt and pgcnt variable initialization is moved before printk
which uses them.

Signed-off-by: Roman Tereshonkov <roman.tereshonkov@nokia.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
drivers/mtd/tests/mtd_subpagetest.c

index 11204e8..334eae5 100644 (file)
@@ -394,6 +394,11 @@ static int __init mtd_subpagetest_init(void)
        }
 
        subpgsize = mtd->writesize >> mtd->subpage_sft;
+       tmp = mtd->size;
+       do_div(tmp, mtd->erasesize);
+       ebcnt = tmp;
+       pgcnt = mtd->erasesize / mtd->writesize;
+
        printk(PRINT_PREF "MTD device size %llu, eraseblock size %u, "
               "page size %u, subpage size %u, count of eraseblocks %u, "
               "pages per eraseblock %u, OOB size %u\n",
@@ -413,11 +418,6 @@ static int __init mtd_subpagetest_init(void)
                goto out;
        }
 
-       tmp = mtd->size;
-       do_div(tmp, mtd->erasesize);
-       ebcnt = tmp;
-       pgcnt = mtd->erasesize / mtd->writesize;
-
        err = scan_for_bad_eraseblocks();
        if (err)
                goto out;