Tested-by: Alexander Shiyan <[email protected]>

ср, 20 мая 2026 г. в 16:49, Ahmad Fatoum <[email protected]>:
>
> of_set_root_node(NULL) used to be valid and the if clause at the start
> of the function explicitly allowed of it.
>
> This was broken by the unconditional use of of_property_write_bool, so
> guard that behind the existence of a root node.
>
> Fixes: b1ced2c3caa9 ("state: suppress state overwrite warning for barebox DT")
> Reported-by: Alexander Shiyan <[email protected]>
> Signed-off-by: Ahmad Fatoum <[email protected]>
> ---
>  drivers/of/base.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/of/base.c b/drivers/of/base.c
> index d4fbd2367baf..57b64bc0b96c 100644
> --- a/drivers/of/base.c
> +++ b/drivers/of/base.c
> @@ -2123,15 +2123,17 @@ int of_set_root_node(struct device_node *node)
>         if (node && root_node)
>                 return -EBUSY;
>
>         root_node = node;
>
>         of_chosen = of_find_node_by_path("/chosen");
>         of_property_read_string(root_node, "model", &of_model);
> -       of_property_write_bool(root_node, "$barebox,root-node", true);
> +
> +       if (root_node)
> +               of_property_write_bool(root_node, "$barebox,root-node", true);
>
>         if (of_model)
>                 barebox_set_model(of_model);
>
>         of_alias_scan();
>
>         return 0;
> --
> 2.47.3
>

Reply via email to