Commit b37ceefe authored by Linas Vepstas's avatar Linas Vepstas Committed by Paul Mackerras

[POWERPC] EEH: Avoid crash on null device

Bugfix: avoid crash if there's no PCI device for a given
openfirmware node.
Signed-off-by: default avatarLinas Vepstas <linas@austin.ibm.com>
Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
parent 2a50f144
...@@ -186,6 +186,11 @@ static size_t gather_pci_data(struct pci_dn *pdn, char * buf, size_t len) ...@@ -186,6 +186,11 @@ static size_t gather_pci_data(struct pci_dn *pdn, char * buf, size_t len)
n += scnprintf(buf+n, len-n, "cmd/stat:%x\n", cfg); n += scnprintf(buf+n, len-n, "cmd/stat:%x\n", cfg);
printk(KERN_WARNING "EEH: PCI cmd/status register: %08x\n", cfg); printk(KERN_WARNING "EEH: PCI cmd/status register: %08x\n", cfg);
if (!dev) {
printk(KERN_WARNING "EEH: no PCI device for this of node\n");
return n;
}
/* Gather bridge-specific registers */ /* Gather bridge-specific registers */
if (dev->class >> 16 == PCI_BASE_CLASS_BRIDGE) { if (dev->class >> 16 == PCI_BASE_CLASS_BRIDGE) {
rtas_read_config(pdn, PCI_SEC_STATUS, 2, &cfg); rtas_read_config(pdn, PCI_SEC_STATUS, 2, &cfg);
...@@ -198,7 +203,7 @@ static size_t gather_pci_data(struct pci_dn *pdn, char * buf, size_t len) ...@@ -198,7 +203,7 @@ static size_t gather_pci_data(struct pci_dn *pdn, char * buf, size_t len)
} }
/* Dump out the PCI-X command and status regs */ /* Dump out the PCI-X command and status regs */
cap = pci_find_capability(pdn->pcidev, PCI_CAP_ID_PCIX); cap = pci_find_capability(dev, PCI_CAP_ID_PCIX);
if (cap) { if (cap) {
rtas_read_config(pdn, cap, 4, &cfg); rtas_read_config(pdn, cap, 4, &cfg);
n += scnprintf(buf+n, len-n, "pcix-cmd:%x\n", cfg); n += scnprintf(buf+n, len-n, "pcix-cmd:%x\n", cfg);
...@@ -210,7 +215,7 @@ static size_t gather_pci_data(struct pci_dn *pdn, char * buf, size_t len) ...@@ -210,7 +215,7 @@ static size_t gather_pci_data(struct pci_dn *pdn, char * buf, size_t len)
} }
/* If PCI-E capable, dump PCI-E cap 10, and the AER */ /* If PCI-E capable, dump PCI-E cap 10, and the AER */
cap = pci_find_capability(pdn->pcidev, PCI_CAP_ID_EXP); cap = pci_find_capability(dev, PCI_CAP_ID_EXP);
if (cap) { if (cap) {
n += scnprintf(buf+n, len-n, "pci-e cap10:\n"); n += scnprintf(buf+n, len-n, "pci-e cap10:\n");
printk(KERN_WARNING printk(KERN_WARNING
...@@ -222,7 +227,7 @@ static size_t gather_pci_data(struct pci_dn *pdn, char * buf, size_t len) ...@@ -222,7 +227,7 @@ static size_t gather_pci_data(struct pci_dn *pdn, char * buf, size_t len)
printk(KERN_WARNING "EEH: PCI-E %02x: %08x\n", i, cfg); printk(KERN_WARNING "EEH: PCI-E %02x: %08x\n", i, cfg);
} }
cap = pci_find_ext_capability(pdn->pcidev, PCI_EXT_CAP_ID_ERR); cap = pci_find_ext_capability(dev, PCI_EXT_CAP_ID_ERR);
if (cap) { if (cap) {
n += scnprintf(buf+n, len-n, "pci-e AER:\n"); n += scnprintf(buf+n, len-n, "pci-e AER:\n");
printk(KERN_WARNING printk(KERN_WARNING
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment