Skip to content

Commit

Permalink
alpha/PCI: Call iomem_is_exclusive() for IORESOURCE_MEM, but not IORE…
Browse files Browse the repository at this point in the history
…SOURCE_IO

The alpha pci_mmap_resource() is used for both IORESOURCE_MEM and
IORESOURCE_IO resources, but iomem_is_exclusive() is only applicable for
IORESOURCE_MEM.

Call iomem_is_exclusive() only for IORESOURCE_MEM resources, and do it
earlier to match the generic version of pci_mmap_resource().

Fixes: 10a0ef3 ("PCI/alpha: pci sysfs resources")
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
CC: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
  • Loading branch information
Bjorn Helgaas committed Apr 25, 2016
1 parent ca62072 commit c20e128
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions arch/alpha/kernel/pci-sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,10 @@ static int pci_mmap_resource(struct kobject *kobj,
if (i >= PCI_ROM_RESOURCE)
return -ENODEV;

if (!__pci_mmap_fits(pdev, i, vma, sparse))
if (res->flags & IORESOURCE_MEM && iomem_is_exclusive(res->start))
return -EINVAL;

if (iomem_is_exclusive(res->start))
if (!__pci_mmap_fits(pdev, i, vma, sparse))
return -EINVAL;

pcibios_resource_to_bus(pdev->bus, &bar, res);
Expand Down

0 comments on commit c20e128

Please sign in to comment.