/* @fdt: ptr to device tree @nodeoffset: node to update  */
unsigned int fdt_create_phandle(void *fdt, int nodeoffset)
/* @fdt: ptr to device tree @nodeoffset: node to update  */
unsigned int fdt_create_phandle(void *fdt, int nodeoffset)
{
	int phandle = fdt_get_phandle(fdt, nodeoffset);
	if (phandle == 0) {
		int ret;
		phandle = fdt_alloc_phandle(fdt);
		ret = fdt_set_phandle(fdt, nodeoffset, phandle);
		if (ret < 0) {
			printf("Can't set phandle %u: %s\n", phandle,
			       fdt_strerror(ret));
			return 0;
		}
	}
	return phandle;
}