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.fat...@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


Reply via email to