mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH] of: platform: don't fail of_find_device_by_node() if no driver bound
Date: Thu, 14 Sep 2023 09:30:18 +0200	[thread overview]
Message-ID: <20230914073018.3462650-1-a.fatoum@pengutronix.de> (raw)

of_find_device_by_node() may be called by a driver following
of_platform_populate in order to bind the children to drivers.
It's thus wrong to return NULL when a device has been found, but no
driver was registered. That also aligns the function with the
expectation resulting from its name: A device is found and devices may
be bound or not.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 drivers/of/platform.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/of/platform.c b/drivers/of/platform.c
index bd5f2ad82c6b..1f79a539f541 100644
--- a/drivers/of/platform.c
+++ b/drivers/of/platform.c
@@ -23,11 +23,9 @@
 struct device *of_find_device_by_node(struct device_node *np)
 {
 	struct device *dev;
-	int ret;
 
-	ret = of_device_ensure_probed(np);
-	if (ret)
-		return NULL;
+	/* Not having a driver is not an error here */
+	(void)of_device_ensure_probed(np);
 
 	if (deep_probe_is_supported())
 		return np->dev;
-- 
2.39.2




             reply	other threads:[~2023-09-14  7:31 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-14  7:30 Ahmad Fatoum [this message]
2023-09-26 11:38 ` Sascha Hauer
2023-10-05  6:53   ` Ahmad Fatoum

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