summaryrefslogtreecommitdiffstats
path: root/common/ubiformat.c
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2018-11-14 12:58:07 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2018-11-14 13:00:54 +0100
commitf4a1c832cfa18b558311b3b3d2b80175cedba422 (patch)
tree11780f3694ed3f66cb24aed7fd3f281c930881b7 /common/ubiformat.c
parent71dd2e1b39e439a6c7ae5e65e6fdb7ae16fc831a (diff)
downloadbarebox-f4a1c832cfa18b558311b3b3d2b80175cedba422.tar.gz
barebox-f4a1c832cfa18b558311b3b3d2b80175cedba422.tar.xz
ubiformat: print messages after checking a block is not bad
ubiformat prints its "flashing eraseblock x" and "formatting eraseblock x" messages before having checked that a block is actually good. This is misleading, so first check if a block is good and only if it is print a message. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common/ubiformat.c')
-rw-r--r--common/ubiformat.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/common/ubiformat.c b/common/ubiformat.c
index 9fe1c7c501..0811525bd2 100644
--- a/common/ubiformat.c
+++ b/common/ubiformat.c
@@ -235,6 +235,9 @@ static int flash_image(struct ubiformat_args *args, struct mtd_info *mtd,
int err, new_len;
long long ec;
+ if (si->ec[eb] == EB_BAD)
+ continue;
+
if (!args->quiet && !args->verbose) {
if (is_timeout(lastprint, 300 * MSECOND) ||
eb == eb_cnt - 1) {
@@ -244,9 +247,6 @@ static int flash_image(struct ubiformat_args *args, struct mtd_info *mtd,
}
}
- if (si->ec[eb] == EB_BAD)
- continue;
-
if (args->verbose) {
normsg_cont("eraseblock %d: erase", eb);
}
@@ -357,6 +357,9 @@ static int format(struct ubiformat_args *args, struct mtd_info *mtd,
for (eb = start_eb; eb < eb_cnt; eb++) {
long long ec;
+ if (si->ec[eb] == EB_BAD)
+ continue;
+
if (!args->quiet && !args->verbose) {
if (is_timeout(lastprint, 300 * MSECOND) ||
eb == eb_cnt - 1) {
@@ -366,9 +369,6 @@ static int format(struct ubiformat_args *args, struct mtd_info *mtd,
}
}
- if (si->ec[eb] == EB_BAD)
- continue;
-
if (args->override_ec)
ec = args->ec;
else if (si->ec[eb] <= EC_MAX)