[PATCH 1/4] arm: mach-k3: Fix phandle corruption in fdt fixup

Anshul Dalal anshuld at ti.com
Tue Jun 23 06:58:49 CEST 2026


On Tue, 09 Jun 2026 23:40:03 +0530, Paresh Bhagat <p-bhagat at ti.com> wrote:
> diff --git a/arch/arm/mach-k3/common_fdt.c b/arch/arm/mach-k3/common_fdt.c
> index 39cb00c3f43..25e40f6a666 100644
> --- a/arch/arm/mach-k3/common_fdt.c
> +++ b/arch/arm/mach-k3/common_fdt.c
> @@ -146,15 +147,14 @@ static int fdt_fixup_reserved_memory(void *blob, const char *name,
>  				false);
>  			if (addr == FDT_ADDR_T_NONE)
>  				return -EINVAL;
> -			new_size = size;

If this removal is intentional, we can get rid of the redundant call to
fdtdec_get_addr_size_auto_parent above since the locals 'addr' and 'size' are no
longer used.

> -
> -			/* Delete node */
> -			ret = fdt_del_node(blob, subnode);
> +			/* Update the reg property in place */
> +			reg[0] = cpu_to_fdt64(new_address);
> +			reg[1] = cpu_to_fdt64(new_size);
> +			ret = fdt_setprop(blob, subnode, "reg", reg, sizeof(reg));
>  			if (ret < 0)
>  				return ret;
>  
> -			/* Only one matching node */
> -			break;
> +			return 0;

You could just do return fdt_setprop(...) here instead. And a similar cleanup
can be done for fdtdec_add_reserved_memory below, if you wanna take it up in the
next revision.

-- 
Anshul Dalal <anshuld at ti.com>


More information about the U-Boot mailing list