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>
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 */
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)