[PATCH] fdt_support: fix fdt_copy_fixed_partitions function()

Dragan Simic dsimic at manjaro.org
Fri Mar 8 15:41:23 CET 2024


Hello Patrice,

Please, see my comment below.

On 2024-03-08 14:34, Patrice Chotard wrote:
> Move variable declaration at the beginning of the function.
> 
> Fixes: 163c5f60ebb4 ("fdt_support: add fdt_copy_fixed_partitions 
> function")
> 
> Signed-off-by: Patrice Chotard <patrice.chotard at foss.st.com>
> ---
> 
>  boot/fdt_support.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/boot/fdt_support.c b/boot/fdt_support.c
> index 090d82ee80a..f948cf8cd42 100644
> --- a/boot/fdt_support.c
> +++ b/boot/fdt_support.c
> @@ -1053,9 +1053,10 @@ void fdt_fixup_mtdparts(void *blob, const
> struct node_info *node_info,
>  int fdt_copy_fixed_partitions(void *blob)
>  {
>  	ofnode node, subnode;
> +	const u32 *reg;
>  	int off, suboff, res;
>  	char path[256];
> -	int address_cells, size_cells;
> +	int address_cells, size_cells, len;
>  	u8 i, j, child_count;
> 
>  	node = ofnode_by_compatible(ofnode_null(), "fixed-partitions");
> @@ -1101,9 +1102,6 @@ int fdt_copy_fixed_partitions(void *blob)
>  			if (!ofnode_valid(subnode))
>  				break;
> 
> -			const u32 *reg;
> -			int len;
> -

Perhaps it would be better to keep these two variables local
to the block they're used in.  I mean, in this case it isn't
a big deal anyway, but results in a bit cleaner code.

>  			suboff = fdt_find_or_add_subnode(blob, off, 
> ofnode_get_name(subnode));
>  			res = fdt_setprop_string(blob, suboff, "label",
>  						 ofnode_read_string(subnode, "label"));


More information about the U-Boot mailing list