Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5463d9f0 authored by Randy Dunlap's avatar Randy Dunlap Committed by Greg Kroah-Hartman
Browse files

PCI: limit pci_get_bus_and_slot to domain 0



Limit pci_get_bus_and_slot() to domain (segment) 0 since domain is not
specified in the function call and defaulting to domain 0 is the only
reasonable thing to do (rather than returning a device from some other
unknown domain).

Signed-off-by: default avatarRandy Dunlap <randy.dunlap@oracle.com>
Acked-by: default avatarH. Peter Anvin <hpa@zytor.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 0bbd6424
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -139,12 +139,14 @@ struct pci_dev * pci_get_slot(struct pci_bus *bus, unsigned int devfn)
}

/**
 * pci_get_bus_and_slot - locate PCI device from a given PCI slot
 * pci_get_bus_and_slot - locate PCI device from a given PCI bus & slot
 * @bus: number of PCI bus on which desired PCI device resides
 * @devfn: encodes number of PCI slot in which the desired PCI
 * device resides and the logical device number within that slot
 * in case of multi-function devices.
 *
 * Note: the bus/slot search is limited to PCI domain (segment) 0.
 *
 * Given a PCI bus and slot/function number, the desired PCI device
 * is located in system global list of PCI devices.  If the device
 * is found, a pointer to its data structure is returned.  If no
@@ -157,7 +159,8 @@ struct pci_dev * pci_get_bus_and_slot(unsigned int bus, unsigned int devfn)
	struct pci_dev *dev = NULL;

	while ((dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) {
		if (dev->bus->number == bus && dev->devfn == devfn)
		if (pci_domain_nr(dev->bus) == 0 &&
		   (dev->bus->number == bus && dev->devfn == devfn))
			return dev;
	}
	return NULL;