netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* mii_bus->read return checking in phy_device.c
@ 2011-03-04 17:25 Florian Fainelli
  2011-03-04 18:06 ` Fleming Andy-AFLEMING
  0 siblings, 1 reply; 5+ messages in thread
From: Florian Fainelli @ 2011-03-04 17:25 UTC (permalink / raw)
  To: netdev; +Cc: David Miller, Andy Fleming

Hello Andy,

While debugging a PHY probing issue with the au1000_eth, I stumbled upon this 
in drivers/net/phy/phy_device.c:

        phy_reg = bus->read(bus, addr, MII_PHYSID1);                                                  
                                   
        if (phy_reg < 0)                        
                return -EIO;

most drivers implement phylib's mdio_read callback by simply returning the 
contents of their MDIO register after a readl, ioread ... which is unsigned. 
Would not it rather make sense to check for phy_reg <= 0 instead?

This can lead for instance to believing that a PHY is present at a wrong 
address because the MDIO read function returns 0 for that particular register, 
which is logical because no PHY is present at that address.

I am asking in case I just miss something.

Thank you.
--
Florian

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-03-07  9:42 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-04 17:25 mii_bus->read return checking in phy_device.c Florian Fainelli
2011-03-04 18:06 ` Fleming Andy-AFLEMING
2011-03-04 18:12   ` Florian Fainelli
2011-03-04 18:19     ` Fleming Andy-AFLEMING
2011-03-07  9:43       ` Florian Fainelli

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).