/* returns: the phandle pointed by the target property 0, if the phandle was not found -1, if the phandle was malformed  */
static uint32_t overlay_get_target_phandle(const void *fdto, int fragment)
/* returns: the phandle pointed by the target property 0, if the phandle was not found -1, if the phandle was malformed  */
static uint32_t overlay_get_target_phandle(const void *fdto, int fragment)
{
	const fdt32_t *val;
	int len;
	val = fdt_getprop(fdto, fragment, "target", &len);
	if (!val)
		return 0;
	if ((len != sizeof(*val)) || (fdt32_to_cpu(*val) == (uint32_t)-1))
		return (uint32_t)-1;
	return fdt32_to_cpu(*val);
}