summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2018-11-15 10:15:38 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2018-11-15 10:15:49 +0100
commit45af01d16dbaabd918c141fcb7dcd7efeeac7c07 (patch)
treebf03eaa24235b903f357c3e89d15d043d53db28a
parentb4bea4a52101a01626667a625622e5415b868185 (diff)
downloadbarebox-45af01d16dbaabd918c141fcb7dcd7efeeac7c07.tar.gz
barebox-45af01d16dbaabd918c141fcb7dcd7efeeac7c07.tar.xz
bootm: Print which file cannot be opened
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>
-rw-r--r--common/bootm.c11
1 files 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");