of_mdio: use IS_ERR_OR_NULL() and PTR_ERR_OR_ZERO()
Subsystems (3)
cover of_mdio: use IS_ERR_OR_NULL() and PTR_ERR_OR_ZERO()
Hello.
Here's the set of 2 patches against DaveM's 'net-next.git' repo. They
replace the patch posted earlier today which was clearly insufficient...
[1/2] of_mdio: use IS_ERR_OR_NULL()
[2/2] of_mdio: use PTR_ERR_OR_ZERO()
MBR, Sergei
PATCH 1/2 of_mdio: use IS_ERR_OR_NULL()
IS_ERR_OR_NULL() is open coded in of_mdiobus_register_{phy|device}(), so just call it directly...
--- drivers/of/of_mdio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/of/of_mdio.c +2 -2
@@ -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(stint rc; mdiodev =mdio_device_create (mdio, addr); -if (!mdiodev ||IS_ERR (mdiodev)) +if (IS_ERR_OR_NULL (mdiodev))return 1 ;/* Associate the OF node with the device structure so it
PATCH 2/2 of_mdio: use PTR_ERR_OR_ZERO()
In reply to Sergei ShtylyovPTR_ERR_OR_ZERO() is open coded in of_phy_register_fixed_link(), so just call it directly...
--- drivers/of/of_mdio.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/of/of_mdio.c +3 -3
@@ -412,7 +412,7 @@ int of_phy_register_fixed_link(struct deif (strcmp (managed,"in-band-status" ) ==0 ) {/* status is zeroed, namely its .link member */ phy =fixed_phy_register (PHY_POLL , &status,-1 , np); -return IS_ERR (phy) ?PTR_ERR (phy) :0 ; +return PTR_ERR_OR_ZERO (phy); } }
@@ -434,7 +434,7 @@ int of_phy_register_fixed_link(struct dereturn -EPROBE_DEFER ; phy =fixed_phy_register (PHY_POLL , &status, link_gpio, np); -return IS_ERR (phy) ?PTR_ERR (phy) :0 ; +return PTR_ERR_OR_ZERO (phy); }/* Old binding */
@@ -446,7 +446,7 @@ int of_phy_register_fixed_link(struct de status.pause =be32_to_cpu (fixed_link_prop[3 ]); status.asym_pause =be32_to_cpu (fixed_link_prop[4 ]); phy =fixed_phy_register (PHY_POLL , &status,-1 , np); -return IS_ERR (phy) ?PTR_ERR (phy) :0 ; +return PTR_ERR_OR_ZERO (phy); }return -ENODEV ;
Re: [PATCH 1/2] of_mdio: use IS_ERR_OR_NULL()
In reply to Sergei ShtylyovQuoted 4 lines · Sergei Shtylyov
IS_ERR_OR_NULL()is open coded in of_mdiobus_register_{phy|device}(), so just call it directly...Signed-off-by Sergei Shtylyov <[email protected]>
Signature · 1 line
Florian
Re: [PATCH 2/2] of_mdio: use PTR_ERR_OR_ZERO()
In reply to Sergei ShtylyovQuoted 4 lines · Sergei Shtylyov
PTR_ERR_OR_ZERO()is open coded inof_phy_register_fixed_link(), so just call it directly...Signed-off-by Sergei Shtylyov <[email protected]>
Signature · 1 line
Florian
Re: [PATCH 1/2] of_mdio: use IS_ERR_OR_NULL()
In reply to a message not in the archiveHello Sergei,
Quoted 23 lines · Sergei Shtylyov
IS_ERR_OR_NULL()is open coded in of_mdiobus_register_{phy|device}(), so just call it directly...--- drivers/of/of_mdio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)Index:
net-next/drivers/of/of_mdio.c
===================================================================drivers/of/of_mdio.c +1
-1@@ -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 );
drivers/of/of_mdio.c static int of_mdiobus_register_device(st · line 103
Quoted 7 lines
drivers/of/of_mdio.c +1
-1@@ -98,7 +98,7 @@ static int of_mdiobus_register_device(stint 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.
drivers/of/of_mdio.c static int of_mdiobus_register_device(st · line 104
Quoted 2 lines
drivers/of/of_mdio.c +0
-0/* 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 [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 2/2] of_mdio: use PTR_ERR_OR_ZERO()
In reply to Sergei ShtylyovHello Sergei,
Quoted 33 lines · Sergei Shtylyov
PTR_ERR_OR_ZERO()is open coded inof_phy_register_fixed_link(), so just call it directly...Signed-off-by Sergei Shtylyov <[email protected]>--- drivers/of/of_mdio.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)Index:
net-next/drivers/of/of_mdio.c
===================================================================drivers/of/of_mdio.c +2
-2@@ -412,7 +412,7 @@ int of_phy_register_fixed_link(struct deif (strcmp (managed,"in-band-status" ) ==0 ) {/* status is zeroed, namely its .link member */ phy =fixed_phy_register (PHY_POLL , &status,-1 , np); -return IS_ERR (phy) ?PTR_ERR (phy) :0 ; +return PTR_ERR_OR_ZERO (phy); } }@@ -434,7 +434,7 @@ int of_phy_register_fixed_link(struct dereturn -EPROBE_DEFER ; phy =fixed_phy_register (PHY_POLL , &status, link_gpio, np); -return IS_ERR (phy) ?PTR_ERR (phy) :0 ; +return PTR_ERR_OR_ZERO (phy); }/* Old binding */
drivers/of/of_mdio.c int of_phy_register_fixed_link(struct de · line 452
Quoted 8 lines
drivers/of/of_mdio.c +1
-1@@ -446,7 +446,7 @@ int of_phy_register_fixed_link(struct de status.pause =be32_to_cpu (fixed_link_prop[3 ]); status.asym_pause =be32_to_cpu (fixed_link_prop[4 ]); phy =fixed_phy_register (PHY_POLL , &status,-1 , np); -return IS_ERR (phy) ?PTR_ERR (phy) :0 ; +return PTR_ERR_OR_ZERO (phy); }return -ENODEV ;
Re: [PATCH 1/2] of_mdio: use IS_ERR_OR_NULL()
In reply to Vladimir ZapolskiyQuoted 28 lines · Vladimir Zapolskiy
Hello Sergei,
Quoted 25 lines · Sergei Shtylyov
IS_ERR_OR_NULL()is open coded in of_mdiobus_register_{phy|device}(), so just call it directly...Signed-off-by Sergei Shtylyov <[email protected]>--- drivers/of/of_mdio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)Index:
net-next/drivers/of/of_mdio.c
===================================================================drivers/of/of_mdio.c +1
-1@@ -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(stint rc;
Quoted 8 lines
drivers/of/of_mdio.c static int of_mdiobus_register_device(st · line 103
Quoted 5 lines
drivers/of/of_mdio.c +1
-1mdiodev =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).
Signature · 1 line
Florian