summaryrefslogtreecommitdiff
path: root/drivers/net/sfc
diff options
context:
space:
mode:
authorSteve Hodgson <shodgson@solarflare.com>2008-12-13 09:08:16 +0300
committerDavid S. Miller <davem@davemloft.net>2008-12-13 09:08:16 +0300
commitfa402b2ea9cacd1ec94fa77e3efb506a5d034da6 (patch)
treeded41421f45edc98d40ce729d61bfea3d91e0d53 /drivers/net/sfc
parentab377358701a981e7fae1332e76b1e5d3b3b313d (diff)
downloadlinux-fa402b2ea9cacd1ec94fa77e3efb506a5d034da6.tar.xz
sfc: Treat probe as unsuccessful if it scheduled a reset
From: Steve Hodgson <shodgson@solarflare.com> efx_pci_probe_main() can return success despite a reset being scheduled. Catch this and retry or abort probe depending on the reset type. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/sfc')
-rw-r--r--drivers/net/sfc/efx.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/drivers/net/sfc/efx.c b/drivers/net/sfc/efx.c
index ce1c7d3cd12e..8f832bf1e4d2 100644
--- a/drivers/net/sfc/efx.c
+++ b/drivers/net/sfc/efx.c
@@ -2112,8 +2112,6 @@ static int __devinit efx_pci_probe(struct pci_dev *pci_dev,
* we're in STATE_INIT. */
for (i = 0; i < 5; i++) {
rc = efx_pci_probe_main(efx);
- if (rc == 0)
- break;
/* Serialise against efx_reset(). No more resets will be
* scheduled since efx_stop_all() has been called, and we
@@ -2121,6 +2119,17 @@ static int __devinit efx_pci_probe(struct pci_dev *pci_dev,
* the rtnetlink or driverlink layers. */
cancel_work_sync(&efx->reset_work);
+ if (rc == 0) {
+ if (efx->reset_pending != RESET_TYPE_NONE) {
+ /* If there was a scheduled reset during
+ * probe, the NIC is probably hosed anyway */
+ efx_pci_remove_main(efx);
+ rc = -EIO;
+ } else {
+ break;
+ }
+ }
+
/* Retry if a recoverably reset event has been scheduled */
if ((efx->reset_pending != RESET_TYPE_INVISIBLE) &&
(efx->reset_pending != RESET_TYPE_ALL))