pci: bugfix, pci_get_domain_bus_and_slot() needs to inc reference count
PATCH 1/1 pci: bugfix, pci_get_domain_bus_and_slot() needs to inc reference count
As the notes of this function, pci_get_domain_bus_and_slot() should increase the reference count.
Signed-off-by Liu Ping Fan <[email protected]>
--- drivers/pci/search.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/pci/search.c +3 -1
@@ -258,8 +258,10 @@ struct pci_dev *pci_get_domain_bus_and_slot(int domain, unsigned int bus,for_each_pci_dev (dev) {if (pci_domain_nr (dev->bus) == domain && - (dev->bus->number == bus && dev->devfn == devfn)) + (dev->bus->number == bus && dev->devfn == devfn)) { +pci_dev_get (dev);return dev; + } }return NULL ; }
Signature · 1 line
1.8.1.4
Quoted 2 lines · Liu Ping Fan
As the notes of this function,
pci_get_domain_bus_and_slot()should increase the reference count.
It had did it.
please refer to:
#define for_each_pci_dev(d) while ((d = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, d)) != NULL)
Quoted 23 lines
Signed-off-by Liu Ping Fan <[email protected]>--- drivers/pci/search.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)drivers/pci/search.c +3
-1@@ -258,8 +258,10 @@ struct pci_dev *pci_get_domain_bus_and_slot(int domain, unsigned int bus,for_each_pci_dev (dev) {if (pci_domain_nr (dev->bus) == domain && - (dev->bus->number == bus && dev->devfn == devfn)) + (dev->bus->number == bus && dev->devfn == devfn)) { +pci_dev_get (dev);return dev; + } }return NULL ; }
Signature · 2 lines
Thanks! Yijing
Quoted 9 lines · Yijing Wang
Quoted 2 lines · Liu Ping Fan
As the notes of this function,
pci_get_domain_bus_and_slot()should increase the reference count.It had did it.
please refer to:#define
for_each_pci_dev(d)while ((d =pci_get_device(PCI_ANY_ID, PCI_ANY_ID, d)) != NULL)
Oh, got it.
Thx!
Quoted 29 lines
Quoted 13 lines
Signed-off-by Liu Ping Fan <[email protected]>--- drivers/pci/search.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)drivers/pci/search.c +0
-0@@ -258,8 +258,10 @@ struct pci_dev *pci_get_domain_bus_and_slot(int domain, unsigned int bus,drivers/pci/search.c struct pci_dev *pci_get_domain_bus_and_slot(int domain, unsigned int bus, · line 267
Quoted 10 lines
drivers/pci/search.c +3
-1for_each_pci_dev (dev) {if (pci_domain_nr (dev->bus) == domain && - (dev->bus->number == bus && dev->devfn == devfn)) + (dev->bus->number == bus && dev->devfn == devfn)) { +pci_dev_get (dev);return dev; + } }return NULL ; }--
Thanks!
Yijing