summaryrefslogtreecommitdiffstats
path: root/arch/powerpc/boot/libfdt-wrapper.c
diff options
context:
space:
mode:
authorScott Wood <scottwood@freescale.com>2007-12-12 08:23:05 +1100
committerPaul Mackerras <paulus@samba.org>2007-12-20 16:11:46 +1100
commit2a9d2d97d370e3fe959312762c3190e6a6ae9e11 (patch)
tree0a8fefe663f64e68b26a4a22c54b6e9fc2401194 /arch/powerpc/boot/libfdt-wrapper.c
parent754e5f3f3a96264b96d5593242d81c7468af70cb (diff)
downloadblackbird-op-linux-2a9d2d97d370e3fe959312762c3190e6a6ae9e11.tar.gz
blackbird-op-linux-2a9d2d97d370e3fe959312762c3190e6a6ae9e11.zip
[POWERPC] wrapper: Treat NULL as root node in devp_offset; add devp_offset_find()
Many operations, as currently used in the wrapper, assume they can pass NULL and have it be treated as the root node. However, libfdt-wrapper converts NULL to -1, which is only appropriate when searching for nodes, and will cause an error otherwise. Signed-off-by: Scott Wood <scottwood@freescale.com> Acked-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc/boot/libfdt-wrapper.c')
-rw-r--r--arch/powerpc/boot/libfdt-wrapper.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/arch/powerpc/boot/libfdt-wrapper.c b/arch/powerpc/boot/libfdt-wrapper.c
index 868c5049a80b..97af36c224bd 100644
--- a/arch/powerpc/boot/libfdt-wrapper.c
+++ b/arch/powerpc/boot/libfdt-wrapper.c
@@ -48,7 +48,8 @@
check_err(_offset) ? NULL : (void *)(_offset+1); \
})
-#define devp_offset(devp) (((int)(devp))-1)
+#define devp_offset_find(devp) (((int)(devp))-1)
+#define devp_offset(devp) (devp ? ((int)(devp))-1 : 0)
static void *fdt;
static void *buf; /* = NULL */
@@ -127,8 +128,9 @@ static void *fdt_wrapper_find_node_by_prop_value(const void *prev,
const char *val,
int len)
{
- return offset_devp(fdt_node_offset_by_prop_value(fdt, devp_offset(prev),
- name, val, len));
+ int offset = fdt_node_offset_by_prop_value(fdt, devp_offset_find(prev),
+ name, val, len);
+ return offset_devp(offset);
}
static char *fdt_wrapper_get_path(const void *devp, char *buf, int len)
OpenPOWER on IntegriCloud