/* @fdt: pointer to the device tree to check/adjust @s: string to find/add @allocated: Set to 0 if the string was found, 1 if not found and so allocated. Ignored if !fdt_chk_basic()  */
static int fdt_find_add_string_(void *fdt, const char *s, int *allocated)
/* @fdt: pointer to the device tree to check/adjust @s: string to find/add @allocated: Set to 0 if the string was found, 1 if not found and so allocated. Ignored if !fdt_chk_basic()  */
static int fdt_find_add_string_(void *fdt, const char *s, int *allocated)
{
	char *strtab = (char *)fdt + fdt_off_dt_strings(fdt);
	const char *p;
	char *new;
	int len = strlen(s) + 1;
	int err;
	if (fdt_chk_basic())
		*allocated = 0;
	p = fdt_find_string_(strtab, fdt_size_dt_strings(fdt), s);
	if (p)
		return (p - strtab);
	new = strtab + fdt_size_dt_strings(fdt);
	err = fdt_splice_string_(fdt, len);
	if (err)
		return err;
	if (fdt_chk_basic())
		*allocated = 1;
	memcpy(new, s, len);
	return (new - strtab);
}