diff options
author | Yuval Mintz <Yuval.Mintz@qlogic.com> | 2016-02-24 09:52:49 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-02-25 16:54:44 -0500 |
commit | 0dfaba6d0b4755fb379bd90dd5451e077617003f (patch) | |
tree | b91ca0c09de23b9fefaa2c006b03d1b6fce88fd4 | |
parent | d43d3f0f393b21ee14c0487d5757edae194c4848 (diff) |
qed: Prevent probe on previous error
Don't allow driver to probe on an adapter at a failed state;
Gracefully block the probe instead.
Signed-off-by: Yuval Mintz <Yuval.Mintz@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/ethernet/qlogic/qed/qed_main.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/net/ethernet/qlogic/qed/qed_main.c b/drivers/net/ethernet/qlogic/qed/qed_main.c index 08cd92d66b6b..e4e6ca5e8cee 100644 --- a/drivers/net/ethernet/qlogic/qed/qed_main.c +++ b/drivers/net/ethernet/qlogic/qed/qed_main.c | |||
@@ -99,12 +99,15 @@ static void qed_free_pci(struct qed_dev *cdev) | |||
99 | pci_disable_device(pdev); | 99 | pci_disable_device(pdev); |
100 | } | 100 | } |
101 | 101 | ||
102 | #define PCI_REVISION_ID_ERROR_VAL 0xff | ||
103 | |||
102 | /* Performs PCI initializations as well as initializing PCI-related parameters | 104 | /* Performs PCI initializations as well as initializing PCI-related parameters |
103 | * in the device structrue. Returns 0 in case of success. | 105 | * in the device structrue. Returns 0 in case of success. |
104 | */ | 106 | */ |
105 | static int qed_init_pci(struct qed_dev *cdev, | 107 | static int qed_init_pci(struct qed_dev *cdev, |
106 | struct pci_dev *pdev) | 108 | struct pci_dev *pdev) |
107 | { | 109 | { |
110 | u8 rev_id; | ||
108 | int rc; | 111 | int rc; |
109 | 112 | ||
110 | cdev->pdev = pdev; | 113 | cdev->pdev = pdev; |
@@ -138,6 +141,14 @@ static int qed_init_pci(struct qed_dev *cdev, | |||
138 | pci_save_state(pdev); | 141 | pci_save_state(pdev); |
139 | } | 142 | } |
140 | 143 | ||
144 | pci_read_config_byte(pdev, PCI_REVISION_ID, &rev_id); | ||
145 | if (rev_id == PCI_REVISION_ID_ERROR_VAL) { | ||
146 | DP_NOTICE(cdev, | ||
147 | "Detected PCI device error [rev_id 0x%x]. Probably due to prior indication. Aborting.\n", | ||
148 | rev_id); | ||
149 | rc = -ENODEV; | ||
150 | goto err2; | ||
151 | } | ||
141 | if (!pci_is_pcie(pdev)) { | 152 | if (!pci_is_pcie(pdev)) { |
142 | DP_NOTICE(cdev, "The bus is not PCI Express\n"); | 153 | DP_NOTICE(cdev, "The bus is not PCI Express\n"); |
143 | rc = -EIO; | 154 | rc = -EIO; |