aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/firewire
diff options
context:
space:
mode:
authorClemens Ladisch <clemens@ladisch.de>2012-06-04 15:28:07 -0400
committerStefan Richter <stefanr@s5r6.in-berlin.de>2012-06-04 18:57:37 -0400
commit7baab9acfb25934a32541d617cbc676abd1fbf5b (patch)
treede78b151877babafbec27b4ae9289673d633a518 /drivers/firewire
parent9d60ef2bd87f201c509cfae13ba6c9013446673d (diff)
firewire: ohci: sanity-check MMIO resource
pci_request_region() does not fail on resources that have not been allocated by the BIOS or by the kernel, so to avoid accessing registers that are not there, we have to check for this explicitly. Signed-off-by: Clemens Ladisch <clemens@ladisch.de> Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Diffstat (limited to 'drivers/firewire')
-rw-r--r--drivers/firewire/ohci.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/firewire/ohci.c b/drivers/firewire/ohci.c
index 1c365b82781..922cd26b25e 100644
--- a/drivers/firewire/ohci.c
+++ b/drivers/firewire/ohci.c
@@ -3545,6 +3545,13 @@ static int __devinit pci_probe(struct pci_dev *dev,
3545 3545
3546 INIT_WORK(&ohci->bus_reset_work, bus_reset_work); 3546 INIT_WORK(&ohci->bus_reset_work, bus_reset_work);
3547 3547
3548 if (!(pci_resource_flags(dev, 0) & IORESOURCE_MEM) ||
3549 pci_resource_len(dev, 0) < OHCI1394_REGISTER_SIZE) {
3550 dev_err(&dev->dev, "invalid MMIO resource\n");
3551 err = -ENXIO;
3552 goto fail_disable;
3553 }
3554
3548 err = pci_request_region(dev, 0, ohci_driver_name); 3555 err = pci_request_region(dev, 0, ohci_driver_name);
3549 if (err) { 3556 if (err) {
3550 dev_err(&dev->dev, "MMIO resource unavailable\n"); 3557 dev_err(&dev->dev, "MMIO resource unavailable\n");