[PATCH v2 3/5] deep-probe: use IS_ERR_OR_NULL() instead of opencoding
Ahmad Fatoum
a.fatoum at pengutronix.de
Mon Feb 19 09:29:23 PST 2024
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 at pengutronix.de>
---
v1 -> v2:
- new patch
---
drivers/of/platform.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/of/platform.c b/drivers/of/platform.c
index 060fa3458bd2..0d1dea2db377 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
--
2.39.2
More information about the barebox
mailing list