Patchwork [4/5] mtd: tests : move ebcnt and pgcnt definitions before usage in printing.

login
register
mail settings
Submitter Adrian Hunter
Date Feb. 8, 2011, 10:02 a.m.
Message ID <1297159362-8407-5-git-send-email-adrian.hunter@nokia.com>
Download mbox | patch
Permalink /patch/82278/
State New
Headers show

Comments

Adrian Hunter - Feb. 8, 2011, 10:02 a.m.
From: Roman Tereshonkov <roman.tereshonkov@nokia.com>

ebcnt and pgcnt variable initialization is moved before printk which
uses them.

Signed-off-by: Roman Tereshonkov <roman.tereshonkov@nokia.com>
---
 drivers/mtd/tests/mtd_subpagetest.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)
Artem Bityutskiy - Feb. 11, 2011, 2:22 p.m.
On Tue, 2011-02-08 at 12:02 +0200, Adrian Hunter wrote:
> From: Roman Tereshonkov <roman.tereshonkov@nokia.com>
> 
> ebcnt and pgcnt variable initialization is moved before printk which
> uses them.
> 
> Signed-off-by: Roman Tereshonkov <roman.tereshonkov@nokia.com>

Pushed all patches to l2-mtd-2.6.git except of this one, because Roman
had already sent it and I already applied it.

Thanks!

Patch

diff --git a/drivers/mtd/tests/mtd_subpagetest.c b/drivers/mtd/tests/mtd_subpagetest.c
index 11204e8..334eae5 100644
--- a/drivers/mtd/tests/mtd_subpagetest.c
+++ b/drivers/mtd/tests/mtd_subpagetest.c
@@ -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;