Re: [PATCH 1/2] of_mdio: use IS_ERR_OR_NULL()

2 messages, 2 authors, 2016-03-11 · open the first message on its own page

Re: [PATCH 1/2] of_mdio: use IS_ERR_OR_NULL()

From: Vladimir Zapolskiy <hidden>
Date: 2016-03-11 22:53:10

Hello Sergei,

On 12.03.2016 00:12, Sergei Shtylyov wrote:
quoted hunk
IS_ERR_OR_NULL() is open coded in of_mdiobus_register_{phy|device}(), so
just call it directly...

Signed-off-by: Sergei Shtylyov <sergei.shtylyov-M4DtvfQ/ZS1MRgGoP+s0PdBPR1lH4CV8@public.gmane.org>

---
 drivers/of/of_mdio.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Index: net-next/drivers/of/of_mdio.c
===================================================================
--- net-next.orig/drivers/of/of_mdio.c
+++ net-next/drivers/of/of_mdio.c
@@ -56,7 +56,7 @@ static int of_mdiobus_register_phy(struc
 		phy = phy_device_create(mdio, addr, phy_id, 0, NULL);
 	else
 		phy = get_phy_device(mdio, addr, is_c45);
-	if (!phy || IS_ERR(phy))
+	if (IS_ERR_OR_NULL(phy))
 		return 1;
 
 	rc = irq_of_parse_and_map(child, 0);
@@ -98,7 +98,7 @@ static int of_mdiobus_register_device(st
 	int rc;
 
 	mdiodev = mdio_device_create(mdio, addr);
-	if (!mdiodev || IS_ERR(mdiodev))
+	if (IS_ERR_OR_NULL(mdiodev))
 		return 1;
 
I don't see how it is possible for mdio_device_create() to return NULL,
instead of this change consider to remove if (!mdiodev) check.
 	/* Associate the OF node with the device structure so it
--
With best wishes,
Vladimir
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Re: [PATCH 1/2] of_mdio: use IS_ERR_OR_NULL()

From: Florian Fainelli <f.fainelli@gmail.com>
Date: 2016-03-11 23:03:31

On 11/03/16 14:53, Vladimir Zapolskiy wrote:
Hello Sergei,

On 12.03.2016 00:12, Sergei Shtylyov wrote:
quoted
IS_ERR_OR_NULL() is open coded in of_mdiobus_register_{phy|device}(), so
just call it directly...

Signed-off-by: Sergei Shtylyov <redacted>

---
 drivers/of/of_mdio.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Index: net-next/drivers/of/of_mdio.c
===================================================================
--- net-next.orig/drivers/of/of_mdio.c
+++ net-next/drivers/of/of_mdio.c
@@ -56,7 +56,7 @@ static int of_mdiobus_register_phy(struc
 		phy = phy_device_create(mdio, addr, phy_id, 0, NULL);
 	else
 		phy = get_phy_device(mdio, addr, is_c45);
-	if (!phy || IS_ERR(phy))
+	if (IS_ERR_OR_NULL(phy))
 		return 1;
 
 	rc = irq_of_parse_and_map(child, 0);
@@ -98,7 +98,7 @@ static int of_mdiobus_register_device(st
 	int rc;
 
 	mdiodev = mdio_device_create(mdio, addr);
-	if (!mdiodev || IS_ERR(mdiodev))
+	if (IS_ERR_OR_NULL(mdiodev))
 		return 1;
 
I don't see how it is possible for mdio_device_create() to return NULL,
instead of this change consider to remove if (!mdiodev) check.
Good point, worst case we return PTR_ERR(-ENOMEM).
-- 
Florian
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help