mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Subject: [PATCH] ubiformat: print messages after checking a block is not bad
Date: Wed, 14 Nov 2018 13:01:11 +0100	[thread overview]
Message-ID: <20181114120112.20748-1-s.hauer@pengutronix.de> (raw)

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>
---
 common/ubiformat.c | 12 ++++++------
 1 file 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)
-- 
2.19.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

                 reply	other threads:[~2018-11-14 12:01 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181114120112.20748-1-s.hauer@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox