[PATCH 32/44] firmware: add easy way to check for existent providers
Ahmad Fatoum
a.fatoum at barebox.org
Mon Aug 11 05:28:12 PDT 2025
This function will be called from the upcoming bfetch command to
determine whether the running barebox has any firmware managers
at all registered.
Signed-off-by: Ahmad Fatoum <a.fatoum at barebox.org>
---
common/firmware.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/common/firmware.c b/common/firmware.c
index 3c7960581f6f..264fc9d66dcc 100644
--- a/common/firmware.c
+++ b/common/firmware.c
@@ -63,18 +63,18 @@ struct firmware_mgr *firmwaremgr_find(const char *id)
*
* Find a firmware device handler using the device node of the firmware
* handler. This allows to retrieve the firmware handler with a phandle from
- * the device tree.
+ * the device tree. If np is NULL, returns the first instance encountered.
*/
struct firmware_mgr *firmwaremgr_find_by_node(struct device_node *np)
{
struct firmware_mgr *mgr;
- char *na, *nb;
+ char *na;
na = of_get_reproducible_name(np);
list_for_each_entry(mgr, &firmwaremgr_list, list) {
- nb = of_get_reproducible_name(mgr->handler->device_node);
- if (!strcmp(na, nb)) {
+ char *nb = of_get_reproducible_name(mgr->handler->device_node);
+ if (!na || !strcmp(na, nb)) {
free(na);
free(nb);
return mgr;
--
2.39.5
More information about the barebox
mailing list