From: Florian Fainelli <florian@openwrt.org>
To: netdev@vger.kernel.org
Cc: David Miller <davem@davemloft.net>,
Andy Fleming <afleming@freescale.com>
Subject: mii_bus->read return checking in phy_device.c
Date: Fri, 4 Mar 2011 18:25:48 +0100 [thread overview]
Message-ID: <201103041825.48765.florian@openwrt.org> (raw)
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
next reply other threads:[~2011-03-04 17:24 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-04 17:25 Florian Fainelli [this message]
2011-03-04 18:06 ` mii_bus->read return checking in phy_device.c 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=201103041825.48765.florian@openwrt.org \
--to=florian@openwrt.org \
--cc=afleming@freescale.com \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.