diff options
author | Paul Mundt <lethal@linux-sh.org> | 2010-01-29 08:22:27 -0500 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2010-01-29 08:22:27 -0500 |
commit | ac8ab54a8e41a5ed0ee2161d45b6dc855490989f (patch) | |
tree | 6872b5d5942338d43ea520060e2b3f2a4287f652 /arch/sh/drivers | |
parent | a45635dfb08a1fa2cf77bf1f2c4074961ce2e625 (diff) |
sh: Bail out early on PCI resource conflicts.
Presently we just call in to request_resource() for the ioport and iomem
resources without checking for errors. This has already hidden a couple
of bugs, so add some error handling in for good measure.
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/sh/drivers')
-rw-r--r-- | arch/sh/drivers/pci/pci.c | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/arch/sh/drivers/pci/pci.c b/arch/sh/drivers/pci/pci.c index 191075e91cda..82e59bc6210e 100644 --- a/arch/sh/drivers/pci/pci.c +++ b/arch/sh/drivers/pci/pci.c | |||
@@ -53,8 +53,12 @@ static DEFINE_MUTEX(pci_scan_mutex); | |||
53 | 53 | ||
54 | void __devinit register_pci_controller(struct pci_channel *hose) | 54 | void __devinit register_pci_controller(struct pci_channel *hose) |
55 | { | 55 | { |
56 | request_resource(&iomem_resource, hose->mem_resource); | 56 | if (request_resource(&iomem_resource, hose->mem_resource) < 0) |
57 | request_resource(&ioport_resource, hose->io_resource); | 57 | goto out; |
58 | if (request_resource(&ioport_resource, hose->io_resource) < 0) { | ||
59 | release_resource(hose->mem_resource); | ||
60 | goto out; | ||
61 | } | ||
58 | 62 | ||
59 | *hose_tail = hose; | 63 | *hose_tail = hose; |
60 | hose_tail = &hose->next; | 64 | hose_tail = &hose->next; |
@@ -76,6 +80,9 @@ void __devinit register_pci_controller(struct pci_channel *hose) | |||
76 | pcibios_scanbus(hose); | 80 | pcibios_scanbus(hose); |
77 | mutex_unlock(&pci_scan_mutex); | 81 | mutex_unlock(&pci_scan_mutex); |
78 | } | 82 | } |
83 | |||
84 | out: | ||
85 | printk(KERN_WARNING "Skipping PCI bus scan due to resource conflict\n"); | ||
79 | } | 86 | } |
80 | 87 | ||
81 | static int __init pcibios_init(void) | 88 | static int __init pcibios_init(void) |
@@ -319,20 +326,9 @@ void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen) | |||
319 | 326 | ||
320 | if (flags & IORESOURCE_IO) | 327 | if (flags & IORESOURCE_IO) |
321 | return ioport_map_pci(dev, start, len); | 328 | return ioport_map_pci(dev, start, len); |
322 | |||
323 | /* | ||
324 | * Presently the IORESOURCE_MEM case is a bit special, most | ||
325 | * SH7751 style PCI controllers have PCI memory at a fixed | ||
326 | * location in the address space where no remapping is desired. | ||
327 | * With the IORESOURCE_MEM case more care has to be taken | ||
328 | * to inhibit page table mapping for legacy cores, but this is | ||
329 | * punted off to __ioremap(). | ||
330 | * -- PFM. | ||
331 | */ | ||
332 | if (flags & IORESOURCE_MEM) { | 329 | if (flags & IORESOURCE_MEM) { |
333 | if (flags & IORESOURCE_CACHEABLE) | 330 | if (flags & IORESOURCE_CACHEABLE) |
334 | return ioremap(start, len); | 331 | return ioremap(start, len); |
335 | |||
336 | return ioremap_nocache(start, len); | 332 | return ioremap_nocache(start, len); |
337 | } | 333 | } |
338 | 334 | ||