diff options
author | Linas Vepstas <linas@austin.ibm.com> | 2007-11-02 16:29:01 -0400 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2007-11-07 22:15:32 -0500 |
commit | b37ceefe7cfc56f27f03269206a53faedb8be9fd (patch) | |
tree | 8915d732dd6b51de362ae9ae08625ffec43a30ab /arch | |
parent | 2a50f144fc6081269468abf79e1907c6669bef22 (diff) |
[POWERPC] EEH: Avoid crash on null device
Bugfix: avoid crash if there's no PCI device for a given
openfirmware node.
Signed-off-by: Linas Vepstas <linas@austin.ibm.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/powerpc/platforms/pseries/eeh.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/arch/powerpc/platforms/pseries/eeh.c b/arch/powerpc/platforms/pseries/eeh.c index 22322b35a0ff..00cfb53d746c 100644 --- a/arch/powerpc/platforms/pseries/eeh.c +++ b/arch/powerpc/platforms/pseries/eeh.c | |||
@@ -186,6 +186,11 @@ static size_t gather_pci_data(struct pci_dn *pdn, char * buf, size_t len) | |||
186 | n += scnprintf(buf+n, len-n, "cmd/stat:%x\n", cfg); | 186 | n += scnprintf(buf+n, len-n, "cmd/stat:%x\n", cfg); |
187 | printk(KERN_WARNING "EEH: PCI cmd/status register: %08x\n", cfg); | 187 | printk(KERN_WARNING "EEH: PCI cmd/status register: %08x\n", cfg); |
188 | 188 | ||
189 | if (!dev) { | ||
190 | printk(KERN_WARNING "EEH: no PCI device for this of node\n"); | ||
191 | return n; | ||
192 | } | ||
193 | |||
189 | /* Gather bridge-specific registers */ | 194 | /* Gather bridge-specific registers */ |
190 | if (dev->class >> 16 == PCI_BASE_CLASS_BRIDGE) { | 195 | if (dev->class >> 16 == PCI_BASE_CLASS_BRIDGE) { |
191 | rtas_read_config(pdn, PCI_SEC_STATUS, 2, &cfg); | 196 | 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 | } | 203 | } |
199 | 204 | ||
200 | /* Dump out the PCI-X command and status regs */ | 205 | /* Dump out the PCI-X command and status regs */ |
201 | cap = pci_find_capability(pdn->pcidev, PCI_CAP_ID_PCIX); | 206 | cap = pci_find_capability(dev, PCI_CAP_ID_PCIX); |
202 | if (cap) { | 207 | if (cap) { |
203 | rtas_read_config(pdn, cap, 4, &cfg); | 208 | rtas_read_config(pdn, cap, 4, &cfg); |
204 | n += scnprintf(buf+n, len-n, "pcix-cmd:%x\n", cfg); | 209 | 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 | } | 215 | } |
211 | 216 | ||
212 | /* If PCI-E capable, dump PCI-E cap 10, and the AER */ | 217 | /* If PCI-E capable, dump PCI-E cap 10, and the AER */ |
213 | cap = pci_find_capability(pdn->pcidev, PCI_CAP_ID_EXP); | 218 | cap = pci_find_capability(dev, PCI_CAP_ID_EXP); |
214 | if (cap) { | 219 | if (cap) { |
215 | n += scnprintf(buf+n, len-n, "pci-e cap10:\n"); | 220 | n += scnprintf(buf+n, len-n, "pci-e cap10:\n"); |
216 | printk(KERN_WARNING | 221 | printk(KERN_WARNING |
@@ -222,7 +227,7 @@ static size_t gather_pci_data(struct pci_dn *pdn, char * buf, size_t len) | |||
222 | printk(KERN_WARNING "EEH: PCI-E %02x: %08x\n", i, cfg); | 227 | printk(KERN_WARNING "EEH: PCI-E %02x: %08x\n", i, cfg); |
223 | } | 228 | } |
224 | 229 | ||
225 | cap = pci_find_ext_capability(pdn->pcidev, PCI_EXT_CAP_ID_ERR); | 230 | cap = pci_find_ext_capability(dev, PCI_EXT_CAP_ID_ERR); |
226 | if (cap) { | 231 | if (cap) { |
227 | n += scnprintf(buf+n, len-n, "pci-e AER:\n"); | 232 | n += scnprintf(buf+n, len-n, "pci-e AER:\n"); |
228 | printk(KERN_WARNING | 233 | printk(KERN_WARNING |