[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [PULL 14/16] sam460ex: Check for errors from libfdt functions
From: |
David Gibson |
Subject: |
[Qemu-ppc] [PULL 14/16] sam460ex: Check for errors from libfdt functions |
Date: |
Mon, 9 Jul 2018 17:43:48 +1000 |
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 <address@hidden>
---
hw/ppc/sam460ex.c | 5 +++--
1 file 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");
}
--
2.17.1
- [Qemu-ppc] [PULL 05/16] sm501: Use values from the pitch register for 2D operations, (continued)
- [Qemu-ppc] [PULL 05/16] sm501: Use values from the pitch register for 2D operations, David Gibson, 2018/07/09
- [Qemu-ppc] [PULL 12/16] ppc: fix default VGA display for PReP machines, David Gibson, 2018/07/09
- [Qemu-ppc] [PULL 03/16] sm501: Implement i2c part for reading monitor EDID, David Gibson, 2018/07/09
- [Qemu-ppc] [PULL 06/16] sm501: Implement negated destination raster operation mode, David Gibson, 2018/07/09
- [Qemu-ppc] [PULL 13/16] sam460ex: Update u-boot-sam460ex firmware, David Gibson, 2018/07/09
- [Qemu-ppc] [PULL 01/16] ppc: fix default VGA display for Mac machines, David Gibson, 2018/07/09
- [Qemu-ppc] [PULL 09/16] sm501: Set updated region dirty after 2D operation, David Gibson, 2018/07/09
- [Qemu-ppc] [PULL 07/16] sm501: Log unimplemented raster operation modes, David Gibson, 2018/07/09
- [Qemu-ppc] [PULL 11/16] target/ppc: fix build on ppc64 host, David Gibson, 2018/07/09
- [Qemu-ppc] [PULL 10/16] ppc440_uc: Fix a copy/paste error, David Gibson, 2018/07/09
- [Qemu-ppc] [PULL 14/16] sam460ex: Check for errors from libfdt functions,
David Gibson <=
- [Qemu-ppc] [PULL 16/16] sam460ex: Make sam460ex_load_device_tree() handle all errors internally, David Gibson, 2018/07/09
- [Qemu-ppc] [PULL 08/16] sm501: Fix support for non-zero frame buffer start address, David Gibson, 2018/07/09
- [Qemu-ppc] [PULL 15/16] sam460ex: Don't check for errors from qemu_fdt_*(), David Gibson, 2018/07/09
- Re: [Qemu-ppc] [PULL 00/16] ppc-for-3.0 queue 20180709, Peter Maydell, 2018/07/09