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 1/2] imd command: Bail out when crc generation/check fails
Date: Mon,  7 Dec 2020 10:10:09 +0100	[thread overview]
Message-ID: <20201207091010.2759-1-s.hauer@pengutronix.de> (raw)

Generating a IMD crc can fail, so bail out with an error when it fails.
Also, when checking a IMD crc the result should be told to the caller.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 common/imd.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/common/imd.c b/common/imd.c
index 4fd4431aa9..4aca8ea78f 100644
--- a/common/imd.c
+++ b/common/imd.c
@@ -489,10 +489,15 @@ int imd_command(int argc, char *argv[])
 		goto out;
 	}
 
-	if (checksum)
-		imd_write_crc32(buf, imd_start, filename, size);
-	if (verify)
-		imd_verify_crc32(buf, size);
+	if (checksum) {
+		ret = imd_write_crc32(buf, imd_start, filename, size);
+		goto out;
+	}
+
+	if (verify) {
+		ret = imd_verify_crc32(buf, size);
+		goto out;
+	}
 
 	if (type == IMD_TYPE_INVALID) {
 		imd_for_each(imd_start, imd) {
-- 
2.20.1


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

             reply	other threads:[~2020-12-07  9:10 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-07  9:10 Sascha Hauer [this message]
2020-12-07  9:10 ` [PATCH 2/2] imd command: Document verbose option Sascha Hauer

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=20201207091010.2759-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