[PATCH 05/18] of: of_path: always call of_partition_ensure_probed before resolving

Marco Felsch m.felsch at pengutronix.de
Wed May 31 09:34:08 PDT 2023


Hi Ahmad,

On 23-05-31, Ahmad Fatoum wrote:
> of_find_path may be called on a partition, whose parent device is not
> yet probed. state code solves that by calling of_partition_ensure_probed
> before of_find_path_by_nde, but really we should be doing that for all

nit: of_find_path_by_node

> calls to of_find_path. Do so.
> 
> Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>

Reviewed-by: Marco Felsch <m.felsch at pengutronix.de>

> ---
>  common/state/state.c | 4 ----
>  drivers/of/of_path.c | 2 ++
>  2 files changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/common/state/state.c b/common/state/state.c
> index 6b4acbb32bcc..11cc86ff73be 100644
> --- a/common/state/state.c
> +++ b/common/state/state.c
> @@ -618,10 +618,6 @@ struct state *state_new_from_node(struct device_node *node, bool readonly)
>  	}
>  
>  #ifdef __BAREBOX__
> -	ret = of_partition_ensure_probed(partition_node);
> -	if (ret)
> -		goto out_release_state;
> -
>  	ret = of_find_path_by_node(partition_node, &state->backend_path, 0);
>  #else
>  	ret = of_get_devicepath(partition_node, &state->backend_path, &offset, &size);
> diff --git a/drivers/of/of_path.c b/drivers/of/of_path.c
> index 1268cf36ee5b..059690e9b8e8 100644
> --- a/drivers/of/of_path.c
> +++ b/drivers/of/of_path.c
> @@ -43,6 +43,8 @@ static int __of_find_path(struct device_node *node, const char *part, char **out
>  	struct cdev *cdev;
>  	bool add_bb = false;
>  
> +	of_partition_ensure_probed(node);
> +
>  	dev = of_find_device_by_node_path(node->full_name);
>  	if (!dev) {
>  		int ret;
> -- 
> 2.39.2
> 
> 
> 



More information about the barebox mailing list