mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <sha@pengutronix.de>
To: Michael Tretter <m.tretter@pengutronix.de>
Cc: barebox@lists.infradead.org, mtr@pengutronix.de
Subject: Re: [PATCH v2] of_firmware: fix lookup of fpga manager
Date: Thu, 10 Aug 2023 07:29:51 +0200	[thread overview]
Message-ID: <20230810052951.GU26314@pengutronix.de> (raw)
In-Reply-To: <20230809100559.2505416-1-m.tretter@pengutronix.de>

On Wed, Aug 09, 2023 at 12:05:59PM +0200, Michael Tretter wrote:
> The of_parse_phandle() looks for the phandle in the root device tree,
> but as np is resolved for the target device tree, the phandle refers to
> the target device tree and may return a wrong node in the root tree.
> 
> Therefore, we must ensure that we look for the manager-node in the
> target device tree, which is the root node of np, and look for the
> manager with that name.
> 
> firmwaremgr_find_by_node already uses the name for the lookup.
> 
> Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
> ---
> Changelog:
> 
> v1 -> v2:
> 
> - Use of_parse_phandle_from instead of open coding the phandle lookup
> ---
>  drivers/of/of_firmware.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)

Applied, thanks

Sascha

> 
> diff --git a/drivers/of/of_firmware.c b/drivers/of/of_firmware.c
> index 80feb3b90dba..c1b69aac045c 100644
> --- a/drivers/of/of_firmware.c
> +++ b/drivers/of/of_firmware.c
> @@ -11,7 +11,8 @@ static struct firmware_mgr *of_node_get_mgr(struct device_node *np)
>  	struct device_node *mgr_node;
>  
>  	do {
> -		mgr_node = of_parse_phandle(np, "fpga-mgr", 0);
> +		mgr_node = of_parse_phandle_from(np, of_find_root_node(np),
> +						 "fpga-mgr", 0);
>  		if (mgr_node)
>  			return firmwaremgr_find_by_node(mgr_node);
>  	} while ((np = of_get_parent(np)) != NULL);
> -- 
> 2.39.2
> 
> 
> 

-- 
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 |



      reply	other threads:[~2023-08-10  5:31 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-09 10:05 Michael Tretter
2023-08-10  5:29 ` Sascha Hauer [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230810052951.GU26314@pengutronix.de \
    --to=sha@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=m.tretter@pengutronix.de \
    --cc=mtr@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox