From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Subject: [PATCH] bootm: Print which file cannot be opened
Date: Thu, 15 Nov 2018 10:19:03 +0100 [thread overview]
Message-ID: <20181115091903.25592-1-s.hauer@pengutronix.de> (raw)
When opening the OS image fails we used to print a message *which* file
could not be opened. This message is no longer printed since we now fail
in read_file_2 when there is an error. Move the message in the
read_file_2 failure path to print it again. file_detect_type() needs no
handling for ret < 0, in case of failure it returns filetype_unknown
which is handled later, so we can remove the error handling there.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
common/bootm.c | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/common/bootm.c b/common/bootm.c
index 169000cccb..36f6c41bbd 100644
--- a/common/bootm.c
+++ b/common/bootm.c
@@ -562,18 +562,15 @@ int bootm_boot(struct bootm_data *bootm_data)
data->os_entry = bootm_data->os_entry;
ret = read_file_2(data->os_file, &size, &data->os_header, PAGE_SIZE);
- if (ret < 0 && ret != -EFBIG)
+ if (ret < 0 && ret != -EFBIG) {
+ printf("could not open %s: %s\n", data->os_file,
+ strerror(-ret));
goto err_out;
+ }
if (size < PAGE_SIZE)
goto err_out;
os_type = file_detect_type(data->os_header, PAGE_SIZE);
- if ((int)os_type < 0) {
- printf("could not open %s: %s\n", data->os_file,
- strerror(-os_type));
- ret = (int)os_type;
- goto err_out;
- }
if (!data->force && os_type == filetype_unknown) {
printf("Unknown OS filetype (try -f)\n");
--
2.19.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
reply other threads:[~2018-11-15 9:19 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=20181115091903.25592-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