PCI: fix bug introduced in pci_save_pcix_state()
PATCH 1/1 PCI: fix bug introduced in pci_save_pcix_state()
From: Ashish Kalra <[email protected]>
For PCIe devices which don't have PCI_CAP_ID_PCIX, this change in pci_save_pcix_state() causes pci_save_state() to return -ENOMEM error and causes e1000e driver probe to fail as follows:
..
[ 15.891676] e1000e: Copyright(c) 1999 - 2015 Intel Corporation. [ 15.921816] e1000e 0000:21:00.0: probe with driver e1000e failed with error -12
...
Fixes 7d90d8d2bb1b ("PCI: Avoid pointless capability searches")
Signed-off-by Ashish Kalra <[email protected]>
--- drivers/pci/pci.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/pci/pci.c +4 -4
@@ -1743,14 +1743,14 @@ static int pci_save_pcix_state(struct pci_dev *dev)struct pci_cap_saved_state *save_state;u8 pos; - save_state =pci_find_saved_cap (dev,PCI_CAP_ID_PCIX ); -if (!save_state) -return -ENOMEM ; - pos =pci_find_capability (dev,PCI_CAP_ID_PCIX );if (!pos)return 0 ; + save_state =pci_find_saved_cap (dev,PCI_CAP_ID_PCIX ); +if (!save_state) +return -ENOMEM ; +pci_read_config_word (dev, pos +PCI_X_CMD , (u16 *)save_state->cap.data);
Signature · 1 line
2.34.1
Quoted 6 lines · Ashish Kalra
From: Ashish Kalra <[email protected]>
For PCIe devices which don't have
PCI_CAP_ID_PCIX, this change inpci_save_pcix_state()causespci_save_state()to return-ENOMEMerror and causes e1000e driver probe to fail as follows:
..
Quoted 6 lines
[ 15.891676] e1000e: Copyright(c) 1999 - 2015 Intel Corporation. [ 15.921816] e1000e 0000:21:00.0: probe with driver e1000e failed with error -12...
Fixes 7d90d8d2bb1b ("PCI: Avoid pointless capability searches")Signed-off-by Ashish Kalra <[email protected]>
I dropped that patch for now, so if you're using current -next you shouldn't see this issue.
Quoted 30 lines
--- drivers/pci/pci.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)drivers/pci/pci.c +4
-4@@ -1743,14 +1743,14 @@ static int pci_save_pcix_state(struct pci_dev *dev)struct pci_cap_saved_state *save_state;u8 pos; - save_state =pci_find_saved_cap (dev,PCI_CAP_ID_PCIX ); -if (!save_state) -return -ENOMEM ; - pos =pci_find_capability (dev,PCI_CAP_ID_PCIX );if (!pos)return 0 ; + save_state =pci_find_saved_cap (dev,PCI_CAP_ID_PCIX ); +if (!save_state) +return -ENOMEM ; +pci_read_config_word (dev, pos +PCI_X_CMD , (u16 *)save_state->cap.data);Signature · 1 line
2.34.1