[PATCH 17/17] of_firmware: Fix handling of firmware-name property
Sascha Hauer
s.hauer at pengutronix.de
Wed Mar 10 13:28:29 GMT 2021
The fpga-region binding states that the firmware-name property must be
in the same node as the fpga-region compatible, so checking for this
compatible when walking up the parents is wrong. Instead, only test for
it in the target node. Also, when the current node is not a fpga-region
we must return successfully.
Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
drivers/of/of_firmware.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/drivers/of/of_firmware.c b/drivers/of/of_firmware.c
index d66f0ae7ce..cf288a0a88 100644
--- a/drivers/of/of_firmware.c
+++ b/drivers/of/of_firmware.c
@@ -11,11 +11,9 @@ static struct firmware_mgr *of_node_get_mgr(struct device_node *np)
struct device_node *mgr_node;
do {
- if (of_device_is_compatible(np, "fpga-region")) {
- mgr_node = of_parse_phandle(np, "fpga-mgr", 0);
- if (mgr_node)
- return firmwaremgr_find_by_node(mgr_node);
- }
+ mgr_node = of_parse_phandle(np, "fpga-mgr", 0);
+ if (mgr_node)
+ return firmwaremgr_find_by_node(mgr_node);
} while ((np = of_get_parent(np)) != NULL);
return NULL;
@@ -39,6 +37,9 @@ static int load_firmware(struct device_node *target,
if (!target)
return -EINVAL;
+ if (!of_device_is_compatible(target, "fpga-region"))
+ return 0;
+
mgr = of_node_get_mgr(target);
if (!mgr)
return -EINVAL;
--
2.29.2
More information about the barebox
mailing list