From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH] of: platform: propagate of_devices_ensure_probed_by(name|property) errors
Date: Mon, 5 Sep 2022 13:59:44 +0200 [thread overview]
Message-ID: <20220905115944.1911301-1-a.fatoum@pengutronix.de> (raw)
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>
---
drivers/of/platform.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/drivers/of/platform.c b/drivers/of/platform.c
index dc784ea8e550..a9a5d4c2daf2 100644
--- a/drivers/of/platform.c
+++ b/drivers/of/platform.c
@@ -525,12 +525,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);
@@ -543,12 +546,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);
--
2.30.2
next reply other threads:[~2022-09-05 15:26 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-05 11:59 Ahmad Fatoum [this message]
2022-09-12 8:50 ` Sascha Hauer
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=20220905115944.1911301-1-a.fatoum@pengutronix.de \
--to=a.fatoum@pengutronix.de \
--cc=barebox@lists.infradead.org \
/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