Skip to contentSkip to conversation

softmmu: Provide a clue as to why device tree loading failed

PATCH Applied Bernhard Beschow 5 participants 5 messages Jan 16, 2022 – Jan 18, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 softmmu: Provide a clue as to why device tree loading failed

fdt_open_into() obligingly returns an error code in case the operation failed. So be obliging as well and use it in the error message.

---
 softmmu/device_tree.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
softmmu/device_tree.c +4 -2
index 3965c834ca..31d1066940 100644
@@ -60,7 +60,8 @@ void *create_device_tree(int *sizep)
     }
     ret = fdt_open_into(fdt, fdt, *sizep);
     if (ret) {
-        error_report("Unable to copy device tree in memory");
+        error_report("%s: Unable to copy device tree into memory: %s",
+                     __func__, fdt_strerror(ret));
         exit(1);
     }
 
@@ -104,7 +105,8 @@ void *load_device_tree(const char *filename_path, int *sizep)
 
     ret = fdt_open_into(fdt, fdt, dt_size);
     if (ret) {
-        error_report("Unable to copy device tree in memory");
+        error_report("%s: Unable to copy device tree into memory: %s",
+                     __func__, fdt_strerror(ret));
         goto fail;
     }
 
Signature · 1 line
2.34.1
Reviewed-by on v1 1/1
#2 lore raw
In reply to Bernhard Beschow
Quoted 4 lines · Bernhard Beschow

fdt_open_into() obligingly returns an error code in case the operation failed. So be obliging as well and use it in the error message.

Quoted 28 lines
---
 softmmu/device_tree.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
softmmu/device_tree.c +4 -2
index 3965c834ca..31d1066940 100644
@@ -60,7 +60,8 @@ void *create_device_tree(int *sizep)
     }
     ret = fdt_open_into(fdt, fdt, *sizep);
     if (ret) {
-        error_report("Unable to copy device tree in memory");
+        error_report("%s: Unable to copy device tree into memory: %s",
+                     __func__, fdt_strerror(ret));
         exit(1);
     }
 
@@ -104,7 +105,8 @@ void *load_device_tree(const char *filename_path, int *sizep)
 
     ret = fdt_open_into(fdt, fdt, dt_size);
     if (ret) {
-        error_report("Unable to copy device tree in memory");
+        error_report("%s: Unable to copy device tree into memory: %s",
+                     __func__, fdt_strerror(ret));
         goto fail;
     }
 
Signature · 4 lines
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson
Reviewed-by on v1 1/1
#3 lore raw
In reply to Bernhard Beschow
Quoted 5 lines · Bernhard Beschow

fdt_open_into() obligingly returns an error code in case the operation failed. So be obliging as well and use it in the error message.

Alistair

Quoted 32 lines
---
 softmmu/device_tree.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
softmmu/device_tree.c +4 -3
index 3965c834ca..31d1066940 100644
@@ -60,7 +60,8 @@ void *create_device_tree(int *sizep)
     }
     ret = fdt_open_into(fdt, fdt, *sizep);
     if (ret) {
-        error_report("Unable to copy device tree in memory");
+        error_report("%s: Unable to copy device tree into memory: %s",
+                     __func__, fdt_strerror(ret));
         exit(1);
     }
 
@@ -104,7 +105,8 @@ void *load_device_tree(const char *filename_path, int *sizep)
 
     ret = fdt_open_into(fdt, fdt, dt_size);
     if (ret) {
-        error_report("Unable to copy device tree in memory");
+        error_report("%s: Unable to copy device tree into memory: %s",
+                     __func__, fdt_strerror(ret));
         goto fail;
     }
 
--

2.34.1

#4 lore raw
In reply to Bernhard Beschow

Le 16/01/2022 à 12:46, Bernhard Beschow a écrit :

Quoted 23 lines

fdt_open_into() obligingly returns an error code in case the operation failed. So be obliging as well and use it in the error message.

---
  softmmu/device_tree.c | 6 ++++--
  1 file changed, 4 insertions(+), 2 deletions(-)
softmmu/device_tree.c +2 -1
index 3965c834ca..31d1066940 100644
@@ -60,7 +60,8 @@ void *create_device_tree(int *sizep)
      }
      ret = fdt_open_into(fdt, fdt, *sizep);
      if (ret) {
-        error_report("Unable to copy device tree in memory");
+        error_report("%s: Unable to copy device tree into memory: %s",
+                     __func__, fdt_strerror(ret));
          exit(1);
      }
 

softmmu/device_tree.c void *load_device_tree(const char *filename_path, int *sizep) · line 112

Quoted 9 lines
softmmu/device_tree.c +2 -1
@@ -104,7 +105,8 @@ void *load_device_tree(const char *filename_path, int *sizep)
 
      ret = fdt_open_into(fdt, fdt, dt_size);
      if (ret) {
-        error_report("Unable to copy device tree in memory");
+        error_report("%s: Unable to copy device tree into memory: %s",
+                     __func__, fdt_strerror(ret));
          goto fail;
      }
 

Applied to my trivial-patches branch.

Thanks,
Laurent