Skip to contentSkip to conversation

Fix NAND erase progress error

PATCH New Hugo Villeneuve 2 participants 2 messages May 15, 2008 – May 16, 2008

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix NAND erase progress error

drivers/mtd/nand/nand_util.c +8 -3
index 6c5624a..bd21e04 100644
@@ -209,10 +209,15 @@ int nand_erase_opts(nand_info_t *meminfo, const nand_erase_options_t *opts)
 		}
 
 		if (!opts->quiet) {
-			unsigned long long n =(unsigned long long)
-				(erase.addr + meminfo->erasesize - opts->offset)
-				* 100;
+			unsigned long long n;
 			int percent;
+			size_t erased_size = erase.addr - opts->offset + meminfo->erasesize;
+
+			if (erased_size > erase_length) {
+				erased_size = erase_length;
+			}
+
+			n = (unsigned long long) erased_size * 100;
 
 			do_div(n, erase_length);
 			percent = (int)n;
#1 lore raw

PATCH 1/1 Fix NAND erase progress error

drivers/mtd/nand/nand_util.c

Quoted 4 lines · In message <[email protected]> you…
drivers/mtd/nand/nand_util.c +0 -0
index 6c5624a..bd21e04 100644

Please describe what the error is, nd add your signed-off-by line.

Best regards,

Wolfgang Denk

Signature · 6 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"What is wanted is not the will to believe, but the will to find out,
which is the exact opposite." - Bertrand Russell, _Sceptical_Essays_,
1928