diff mbox

macb: fix mdiobus_scan() error check

Message ID 2317306.aZN9iKAKYz@wasted.cogentembedded.com
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Sergei Shtylyov April 30, 2016, 10:47 p.m. UTC
Now mdiobus_scan() returns ERR_PTR(-ENODEV) instead of NULL if the PHY
device ID was read as all ones. As this was not  an error before, this
value  should be filtered out now in this driver.

Fixes: b74766a0a0fe ("phylib: don't return NULL from get_phy_device()")
Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>

---
The patch is against DaveM's 'net-next.git' repo.

 drivers/net/ethernet/cadence/macb.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Florian Fainelli May 1, 2016, 4:03 p.m. UTC | #1
Le 30/04/2016 15:47, Sergei Shtylyov a écrit :
> Now mdiobus_scan() returns ERR_PTR(-ENODEV) instead of NULL if the PHY
> device ID was read as all ones. As this was not  an error before, this
> value  should be filtered out now in this driver.
> 
> Fixes: b74766a0a0fe ("phylib: don't return NULL from get_phy_device()")
> Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Nicolas Ferre May 2, 2016, 7:39 a.m. UTC | #2
Le 01/05/2016 00:47, Sergei Shtylyov a écrit :
> Now mdiobus_scan() returns ERR_PTR(-ENODEV) instead of NULL if the PHY
> device ID was read as all ones. As this was not  an error before, this
> value  should be filtered out now in this driver.
> 
> Fixes: b74766a0a0fe ("phylib: don't return NULL from get_phy_device()")
> Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>

Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>

Thanks.

> 
> ---
> The patch is against DaveM's 'net-next.git' repo.
> 
>  drivers/net/ethernet/cadence/macb.c |    3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> Index: net-next/drivers/net/ethernet/cadence/macb.c
> ===================================================================
> --- net-next.orig/drivers/net/ethernet/cadence/macb.c
> +++ net-next/drivers/net/ethernet/cadence/macb.c
> @@ -458,7 +458,8 @@ static int macb_mii_init(struct macb *bp
>  				struct phy_device *phydev;
>  
>  				phydev = mdiobus_scan(bp->mii_bus, i);
> -				if (IS_ERR(phydev)) {
> +				if (IS_ERR(phydev) &&
> +				    PTR_ERR(phydev) != -ENODEV) {
>  					err = PTR_ERR(phydev);
>  					break;
>  				}
> 
>
David Miller May 3, 2016, 7:04 p.m. UTC | #3
From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Date: Sun, 01 May 2016 01:47:36 +0300

> Now mdiobus_scan() returns ERR_PTR(-ENODEV) instead of NULL if the PHY
> device ID was read as all ones. As this was not  an error before, this
> value  should be filtered out now in this driver.
> 
> Fixes: b74766a0a0fe ("phylib: don't return NULL from get_phy_device()")
> Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>

Applied.
diff mbox

Patch

Index: net-next/drivers/net/ethernet/cadence/macb.c
===================================================================
--- net-next.orig/drivers/net/ethernet/cadence/macb.c
+++ net-next/drivers/net/ethernet/cadence/macb.c
@@ -458,7 +458,8 @@  static int macb_mii_init(struct macb *bp
 				struct phy_device *phydev;
 
 				phydev = mdiobus_scan(bp->mii_bus, i);
-				if (IS_ERR(phydev)) {
+				if (IS_ERR(phydev) &&
+				    PTR_ERR(phydev) != -ENODEV) {
 					err = PTR_ERR(phydev);
 					break;
 				}