summaryrefslogtreecommitdiffstats
path: root/hw/ppc/sam460ex.c
diff options
context:
space:
mode:
authorDavid Gibson2018-07-09 06:23:05 +0200
committerDavid Gibson2018-07-09 06:23:05 +0200
commitad633de6f5a08ad8e9b74e2372863101239c2cc3 (patch)
tree32b8ef6ecafb8153dc3ac23b72078f858dfa8ec0 /hw/ppc/sam460ex.c
parentsam460ex: Update u-boot-sam460ex firmware (diff)
downloadqemu-ad633de6f5a08ad8e9b74e2372863101239c2cc3.tar.gz
qemu-ad633de6f5a08ad8e9b74e2372863101239c2cc3.tar.xz
qemu-ad633de6f5a08ad8e9b74e2372863101239c2cc3.zip
sam460ex: Check for errors from libfdt functions
In a couple of places sam460ex_load_device_tree() calls "raw" libfdt functions which can fail, but doesn't check for error codes. At best, if these fail the guest will be silently started in a non-standard state, or it could fail entirely. Fix this by using the _FDT() helper macro which aborts on a libfdt failure. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'hw/ppc/sam460ex.c')
-rw-r--r--hw/ppc/sam460ex.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/hw/ppc/sam460ex.c b/hw/ppc/sam460ex.c
index 7eed2ec601..1661e036f3 100644
--- a/hw/ppc/sam460ex.c
+++ b/hw/ppc/sam460ex.c
@@ -36,6 +36,7 @@
#include "hw/i2c/ppc4xx_i2c.h"
#include "hw/i2c/smbus.h"
#include "hw/usb/hcd-ehci.h"
+#include "hw/ppc/fdt.h"
#include <libfdt.h>
@@ -318,13 +319,13 @@ static int sam460ex_load_device_tree(hwaddr addr,
/* Remove cpm node if it exists (it is not emulated) */
offset = fdt_path_offset(fdt, "/cpm");
if (offset >= 0) {
- fdt_nop_node(fdt, offset);
+ _FDT(fdt_nop_node(fdt, offset));
}
/* set serial port clocks */
offset = fdt_node_offset_by_compatible(fdt, -1, "ns16550");
while (offset >= 0) {
- fdt_setprop_cell(fdt, offset, "clock-frequency", UART_FREQ);
+ _FDT(fdt_setprop_cell(fdt, offset, "clock-frequency", UART_FREQ));
offset = fdt_node_offset_by_compatible(fdt, offset, "ns16550");
}