[PATCH v2 3/5] deep-probe: use IS_ERR_OR_NULL() instead of opencoding

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxx>
---
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





[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux