diff options
| author | Artem Bityutskiy <Artem.Bityutskiy@nokia.com> | 2009-11-26 11:38:45 +0200 | 
|---|---|---|
| committer | Artem Bityutskiy <Artem.Bityutskiy@nokia.com> | 2009-11-26 11:38:45 +0200 | 
| commit | 14da740cec46d151e813905e449e7ff21e85c01f (patch) | |
| tree | 1d4daf15a6848f812a9ee5a1f379608935c4d649 | |
| parent | 600337e7c81e812d34460b413c5b044f454bc49d (diff) | |
ubiformat: fix --erase-counter handling
The --erase-counter option did not work and this was reproted by
Darwin Rambo <drambo@broadcom.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
| -rw-r--r-- | ubi-utils/src/ubiformat.c | 17 | 
1 files changed, 8 insertions, 9 deletions
diff --git a/ubi-utils/src/ubiformat.c b/ubi-utils/src/ubiformat.c index 62375a6..681ea30 100644 --- a/ubi-utils/src/ubiformat.c +++ b/ubi-utils/src/ubiformat.c @@ -506,13 +506,12 @@ static int flash_image(const struct mtd_dev_info *mtd, struct ubi_scan_info *si)  			goto out_close;  		} - -		if (si->ec[eb] <= EC_MAX) +		if (args.override_ec) +			ec = args.ec; +		else if (si->ec[eb] <= EC_MAX)  			ec = si->ec[eb] + 1; -		else if (!args.override_ec) -			ec = si->mean_ec;  		else -			ec = args.ec; +			ec = si->mean_ec;  		if (args.verbose) {  			printf(", change EC to %lld", ec); @@ -590,12 +589,12 @@ static int format(const struct mtd_dev_info *mtd, const struct ubigen_info *ui,  		if (si->ec[eb] == EB_BAD)  			continue; -		if (si->ec[eb] <= EC_MAX) +		if (args.override_ec) +			ec = args.ec; +		else if (si->ec[eb] <= EC_MAX)  			ec = si->ec[eb] + 1; -		else if (!args.override_ec) -			ec = si->mean_ec;  		else -			ec = args.ec; +			ec = si->mean_ec;  		ubigen_init_ec_hdr(ui, hdr, ec);  		if (args.verbose) {  | 
