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>
This commit is contained in:
parent
a45635dfb0
commit
ac8ab54a8e
1 changed files with 9 additions and 13 deletions
|
@ -53,8 +53,12 @@ static DEFINE_MUTEX(pci_scan_mutex);
|
||||||
|
|
||||||
void __devinit register_pci_controller(struct pci_channel *hose)
|
void __devinit register_pci_controller(struct pci_channel *hose)
|
||||||
{
|
{
|
||||||
request_resource(&iomem_resource, hose->mem_resource);
|
if (request_resource(&iomem_resource, hose->mem_resource) < 0)
|
||||||
request_resource(&ioport_resource, hose->io_resource);
|
goto out;
|
||||||
|
if (request_resource(&ioport_resource, hose->io_resource) < 0) {
|
||||||
|
release_resource(hose->mem_resource);
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
*hose_tail = hose;
|
*hose_tail = hose;
|
||||||
hose_tail = &hose->next;
|
hose_tail = &hose->next;
|
||||||
|
@ -76,6 +80,9 @@ void __devinit register_pci_controller(struct pci_channel *hose)
|
||||||
pcibios_scanbus(hose);
|
pcibios_scanbus(hose);
|
||||||
mutex_unlock(&pci_scan_mutex);
|
mutex_unlock(&pci_scan_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
out:
|
||||||
|
printk(KERN_WARNING "Skipping PCI bus scan due to resource conflict\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
static int __init pcibios_init(void)
|
static int __init pcibios_init(void)
|
||||||
|
@ -319,20 +326,9 @@ void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen)
|
||||||
|
|
||||||
if (flags & IORESOURCE_IO)
|
if (flags & IORESOURCE_IO)
|
||||||
return ioport_map_pci(dev, start, len);
|
return ioport_map_pci(dev, start, len);
|
||||||
|
|
||||||
/*
|
|
||||||
* Presently the IORESOURCE_MEM case is a bit special, most
|
|
||||||
* SH7751 style PCI controllers have PCI memory at a fixed
|
|
||||||
* location in the address space where no remapping is desired.
|
|
||||||
* With the IORESOURCE_MEM case more care has to be taken
|
|
||||||
* to inhibit page table mapping for legacy cores, but this is
|
|
||||||
* punted off to __ioremap().
|
|
||||||
* -- PFM.
|
|
||||||
*/
|
|
||||||
if (flags & IORESOURCE_MEM) {
|
if (flags & IORESOURCE_MEM) {
|
||||||
if (flags & IORESOURCE_CACHEABLE)
|
if (flags & IORESOURCE_CACHEABLE)
|
||||||
return ioremap(start, len);
|
return ioremap(start, len);
|
||||||
|
|
||||||
return ioremap_nocache(start, len);
|
return ioremap_nocache(start, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue