diff options
author | Ahmad Fatoum <a.fatoum@pengutronix.de> | 2024-02-19 18:29:23 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2024-02-20 12:08:30 +0100 |
commit | 05785e25af004ad6b363fec085ed77a3916422a2 (patch) | |
tree | e2d591d46cdffab0ba16b8228b1cf8beeeef43e7 | |
parent | 8a42a6bf42b0dc1890130055cbf8fa53182023e8 (diff) | |
download | barebox-05785e25af00.tar.gz barebox-05785e25af00.tar.xz |
deep-probe: use IS_ERR_OR_NULL() instead of opencoding
of_device_create_on_demand either returns a valid pointer, -ENODEV or NULL.
of_device_create_on_demand is a recursive function, which either returns
a valid pointer, ERR_PTR(-ENODEV) or NULL.
Retuning either ERR_PTR(-ENODEV) or NULL is needed for its proper
operation, but of_device_ensure_proped treats both the same, so use
IS_ERR_OR_NULL() to make this apparent.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20240219172925.3798024-3-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r-- | drivers/of/platform.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/drivers/of/platform.c b/drivers/of/platform.c index 060fa3458b..0d1dea2db3 100644 --- a/drivers/of/platform.c +++ b/drivers/of/platform.c @@ -491,10 +491,8 @@ int of_device_ensure_probed(struct device_node *np) return 0; dev = of_device_create_on_demand(np); - if (!dev) + if (IS_ERR_OR_NULL(dev)) return -ENODEV; - if (IS_ERR(dev)) - return PTR_ERR(dev); /* * The deep-probe mechanism relies on the fact that all necessary |