[PATCH] of: do not copy properties if they already exist in the destination

Ahmad Fatoum a.fatoum at pengutronix.de
Mon Apr 15 01:30:44 PDT 2024


On 15.04.24 10:14, Jonas Richardsen wrote:

Please write a short sentence here, justifying the change and add
you S-o-b, see https://developercertificate.org/

> ---
>  drivers/of/base.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/of/base.c b/drivers/of/base.c
> index b22959dabe..9bb4ae13db 100644
> --- a/drivers/of/base.c
> +++ b/drivers/of/base.c
> @@ -2346,6 +2346,9 @@ struct property *of_copy_property(const struct device_node *src,
>  	if (!prop)
>  		return NULL;
>  
> +	if (of_find_property(dst, propname, NULL))
> +		return ERR_PTR(-EEXIST);

Use of_property_present() here instead.

Cheers,
Ahmad

> +
>  	return of_new_property(dst, propname,
>  			       of_property_get_value(prop), prop->length);
>  }

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |




More information about the barebox mailing list