mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/2] imd command: Bail out when crc generation/check fails
@ 2020-12-07  9:10 Sascha Hauer
  2020-12-07  9:10 ` [PATCH 2/2] imd command: Document verbose option Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Sascha Hauer @ 2020-12-07  9:10 UTC (permalink / raw)
  To: Barebox List

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-12-07  9:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-07  9:10 [PATCH 1/2] imd command: Bail out when crc generation/check fails Sascha Hauer
2020-12-07  9:10 ` [PATCH 2/2] imd command: Document verbose option Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox