* [PATCH] sfc: mdio_clause45_read errors go unnoticed
@ 2009-02-27 16:31 Roel Kluin
2009-02-27 16:45 ` Ben Hutchings
0 siblings, 1 reply; 2+ messages in thread
From: Roel Kluin @ 2009-02-27 16:31 UTC (permalink / raw)
To: linux-net-drivers; +Cc: netdev, David S. Miller, Andrew Morton
This patch was not tested in any way, but:
since commit 27dd2caca4eabe7c13a052b7456495ba75535e6a
------------------------------>8-------------8<---------------------------------
mdio_clause45_read may return -ERR, but since 'devices' is unsigned, this is not
noticed.
Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
---
diff --git a/drivers/net/sfc/mdio_10g.c b/drivers/net/sfc/mdio_10g.c
index f9e2f95..bcb5ddc 100644
--- a/drivers/net/sfc/mdio_10g.c
+++ b/drivers/net/sfc/mdio_10g.c
@@ -126,23 +126,29 @@ int mdio_clause45_check_mmds(struct efx_nic *efx,
unsigned int mmd_mask, unsigned int fatal_mask)
{
u32 devices;
- int mmd = 0, probe_mmd;
+ int ret, mmd = 0, probe_mmd;
/* Historically we have probed the PHYXS to find out what devices are
* present,but that doesn't work so well if the PHYXS isn't expected
* to exist, if so just find the first item in the list supplied. */
probe_mmd = (mmd_mask & MDIO_MMDREG_DEVS_PHYXS) ? MDIO_MMD_PHYXS :
__ffs(mmd_mask);
- devices = (mdio_clause45_read(efx, efx->mii.phy_id,
- probe_mmd, MDIO_MMDREG_DEVS0) |
- mdio_clause45_read(efx, efx->mii.phy_id,
- probe_mmd, MDIO_MMDREG_DEVS1) << 16);
- /* Check all the expected MMDs are present */
- if (devices < 0) {
+ ret = mdio_clause45_read(efx, efx->mii.phy_id, probe_mmd,
+ MDIO_MMDREG_DEVS0);
+ if (ret >= 0) {
+ devices = ret;
+ ret = mdio_clause45_read(efx, efx->mii.phy_id, probe_mmd,
+ MDIO_MMDREG_DEVS1);
+ }
+
+ /* Check all the expected MMDs were present */
+ if (ret < 0) {
EFX_ERR(efx, "failed to read devices present\n");
return -EIO;
}
+ devices |= ret << 16;
+
if ((devices & mmd_mask) != mmd_mask) {
EFX_ERR(efx, "required MMDs not present: got %x, "
"wanted %x\n", devices, mmd_mask);
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] sfc: mdio_clause45_read errors go unnoticed
2009-02-27 16:31 [PATCH] sfc: mdio_clause45_read errors go unnoticed Roel Kluin
@ 2009-02-27 16:45 ` Ben Hutchings
0 siblings, 0 replies; 2+ messages in thread
From: Ben Hutchings @ 2009-02-27 16:45 UTC (permalink / raw)
To: Roel Kluin; +Cc: linux-net-drivers, netdev, David S. Miller, Andrew Morton
On Fri, 2009-02-27 at 17:31 +0100, Roel Kluin wrote:
> This patch was not tested in any way, but:
>
> since commit 27dd2caca4eabe7c13a052b7456495ba75535e6a
> ------------------------------>8-------------8<---------------------------------
> mdio_clause45_read may return -ERR, but since 'devices' is unsigned, this is not
> noticed.
I already submitted a fix for this. I do need to resubmit it for
net-next-2.6 though. Thanks for the reminder.
Ben.
--
Ben Hutchings, Senior Software Engineer, Solarflare Communications
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-02-27 16:45 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-27 16:31 [PATCH] sfc: mdio_clause45_read errors go unnoticed Roel Kluin
2009-02-27 16:45 ` Ben Hutchings
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).