summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorAhmad Fatoum <a.fatoum@pengutronix.de>2022-09-05 13:59:44 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2022-09-12 10:50:01 +0200
commit4ff6430adde85818b61d9243e8a50ab9eb64e421 (patch)
treee46ce3d378ce894824180fdfeba97e9083ba044c /drivers
parent883c57b139e54586284e0069537f6d6e11751059 (diff)
downloadbarebox-4ff6430adde85818b61d9243e8a50ab9eb64e421.tar.gz
barebox-4ff6430adde85818b61d9243e8a50ab9eb64e421.tar.xz
of: platform: propagate of_devices_ensure_probed_by(name|property) errors
The of_devices_ensure_probed_by functions are expected to return an error code after iterating over all matching devices should any device have failed its of_device_ensure_probed. Doing this unearths one common failure: a matching node has status = "disabled". These will have of_device_ensure_probed return -ENODEV, which makes sense for users wanting to ensure a specific device is probed, but doesn't when iterating over multiple nodes. We already have of_devices_ensure_probed_by_dev_id, which does an early of_device_is_available check, so do likewise for the other to ensure_probed_by_* functions. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20220905115944.1911301-1-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/of/platform.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/drivers/of/platform.c b/drivers/of/platform.c
index 7f377b8b37..dd86667f88 100644
--- a/drivers/of/platform.c
+++ b/drivers/of/platform.c
@@ -522,12 +522,15 @@ int of_devices_ensure_probed_by_property(const char *property_name)
return 0;
for_each_node_with_property(node, property_name) {
- ret = of_device_ensure_probed(node);
+ if (!of_device_is_available(node))
+ continue;
+
+ err = of_device_ensure_probed(node);
if (err)
ret = err;
}
- return 0;
+ return ret;
}
EXPORT_SYMBOL_GPL(of_devices_ensure_probed_by_property);
@@ -540,12 +543,15 @@ int of_devices_ensure_probed_by_name(const char *name)
return 0;
for_each_node_by_name(node, name) {
- ret = of_device_ensure_probed(node);
+ if (!of_device_is_available(node))
+ continue;
+
+ err = of_device_ensure_probed(node);
if (err)
ret = err;
}
- return 0;
+ return ret;
}
EXPORT_SYMBOL_GPL(of_devices_ensure_probed_by_name);