From 9b6bb220ef44a0d2eab1ea0a3a35609d8c006d8c Mon Sep 17 00:00:00 2001 From: Giuseppe Cavallaro Date: Thu, 20 Nov 2008 20:43:18 -0800 Subject: [PATCH] --- yaml --- r: 119601 b: refs/heads/master c: 6436cbcd735a11fc93bf3353c68914bc545e6d1e h: refs/heads/master i: 119599: 4a6032ee361bebaddd6b66202720026e3108bdad v: v3 --- [refs] | 2 +- trunk/drivers/net/phy/phy_device.c | 13 +++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/[refs] b/[refs] index b21751bb0655..3ee71a8c4f3b 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 75e07fc3d87ba9b3255e1fcd735186a533ea0754 +refs/heads/master: 6436cbcd735a11fc93bf3353c68914bc545e6d1e diff --git a/trunk/drivers/net/phy/phy_device.c b/trunk/drivers/net/phy/phy_device.c index 55bc24b234e3..25acbbde4a60 100644 --- a/trunk/drivers/net/phy/phy_device.c +++ b/trunk/drivers/net/phy/phy_device.c @@ -227,8 +227,17 @@ struct phy_device * get_phy_device(struct mii_bus *bus, int addr) if (r) return ERR_PTR(r); - /* If the phy_id is all Fs or all 0s, there is no device there */ - if ((0xffff == phy_id) || (0x00 == phy_id)) + /* If the phy_id is mostly Fs, there is no device there */ + if ((phy_id & 0x1fffffff) == 0x1fffffff) + return NULL; + + /* + * Broken hardware is sometimes missing the pull down resistor on the + * MDIO line, which results in reads to non-existent devices returning + * 0 rather than 0xffff. Catch this here and treat 0 as a non-existent + * device as well. + */ + if (phy_id == 0) return NULL; dev = phy_device_create(bus, addr, phy_id);