From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH 2/8] deep-probe: don't panic when device can't be created
Date: Mon, 27 Nov 2023 07:35:53 +0100 [thread overview]
Message-ID: <20231127063559.2205776-3-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20231127063559.2205776-1-a.fatoum@pengutronix.de>
of_device_ensure_probed() already returns error codes, e.g. when
of_device_create_on_demand attempts recreating a device with the same name.
In some error cases though that shouldn't happen in normal operation,
of_device_create_on_demand() returns NULL, which triggers a panic.
During development, returning NULL can happen more often, so aborting
barebox startup is unnecessarily harsh. Follow-up commit will add other
ways for of_device_create_on_demand to return NULL, so the panic is even
more out of place. Let's just return a silent error code instead.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
drivers/of/platform.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/of/platform.c b/drivers/of/platform.c
index 1f79a539f541..9e592d567cae 100644
--- a/drivers/of/platform.c
+++ b/drivers/of/platform.c
@@ -486,12 +486,11 @@ int of_device_ensure_probed(struct device_node *np)
return 0;
dev = of_device_create_on_demand(np);
+ if (!dev)
+ return -ENODEV;
if (IS_ERR(dev))
return PTR_ERR(dev);
- if (!dev)
- panic("deep-probe: device for '%pOF' couldn't be created\n", np);
-
/*
* The deep-probe mechanism relies on the fact that all necessary
* drivers are added before the device creation. Furthermore deep-probe
--
2.39.2
next prev parent reply other threads:[~2023-11-27 6:38 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-27 6:35 [PATCH 0/8] optee: add bidirectional communication support Ahmad Fatoum
2023-11-27 6:35 ` [PATCH 1/8] driver: don't clear unrelated struct device_node::device on unregister Ahmad Fatoum
2023-11-27 6:35 ` Ahmad Fatoum [this message]
2023-11-27 6:35 ` [PATCH 3/8] deep-probe: skip on-demand platform dev creation for nodes without compatible Ahmad Fatoum
2023-11-29 9:12 ` Sascha Hauer
2023-11-30 8:02 ` Ahmad Fatoum
2023-11-27 6:35 ` [PATCH 4/8] devinfo: indicate if device tree nodes are differently populated Ahmad Fatoum
2023-11-27 6:35 ` [PATCH 5/8] include: uaccess.h: import from linux Ahmad Fatoum
2023-11-27 6:35 ` [PATCH 6/8] optee: add bidirectional communication support Ahmad Fatoum
2023-11-27 6:35 ` [PATCH 7/8] optee: add experimental support for /dev/tee0 Ahmad Fatoum
2023-11-27 6:35 ` [PATCH 8/8] hw_random: add implementation for OP-TEE RNG pseudo TA Ahmad Fatoum
2023-12-01 10:39 ` [PATCH 0/8] optee: add bidirectional communication support 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=20231127063559.2205776-3-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