Skip to content

Commit

Permalink
sfc: Fix SFE4002 initialisation
Browse files Browse the repository at this point in the history
From: Steve Hodgson <shodgson@solarflare.com>

Commit 357d46a "sfc: QT202x: Remove
unreliable MMD check at initialisation" broke initialisation of the
SFE4002.  efx_mdio_reset_mmd() returns a positive value rather than 0
on success.  The above commit causes this value to be propagated up
by qt202x_reset_phy(), which is treated as a failure by its callers.
Change qt202x_reset_phy() to return 0 if successful.

The PCI layer treats >0 as "fail, but please call remove() anyway",
which means that unloading the driver would cause a crash.  Add a
WARN_ON() on the failure path of efx_pci_probe() to provide early
warning if there are any other cases where we do this.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Steve Hodgson authored and David S. Miller committed Feb 12, 2010
1 parent c6b471e commit 5e2a911
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions drivers/net/sfc/efx.c
Original file line number Diff line number Diff line change
Expand Up @@ -2284,6 +2284,7 @@ static int __devinit efx_pci_probe(struct pci_dev *pci_dev,
fail2:
efx_fini_struct(efx);
fail1:
WARN_ON(rc > 0);
EFX_LOG(efx, "initialisation failed. rc=%d\n", rc);
free_netdev(net_dev);
return rc;
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/sfc/qt202x_phy.c
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ static int qt202x_reset_phy(struct efx_nic *efx)

falcon_board(efx)->type->init_phy(efx);

return rc;
return 0;

fail:
EFX_ERR(efx, "PHY reset timed out\n");
Expand Down

0 comments on commit 5e2a911

Please sign in to comment.