All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] pci: bugfix, pci_get_domain_bus_and_slot() needs to inc reference count
@ 2014-08-12  0:31 Liu Ping Fan
  2014-08-12  1:43 ` Yijing Wang
  0 siblings, 1 reply; 3+ messages in thread
From: Liu Ping Fan @ 2014-08-12  0:31 UTC (permalink / raw)
  To: linux-pci; +Cc: Bjorn Helgaas

As the notes of this function, pci_get_domain_bus_and_slot() should
increase the reference count.

Signed-off-by: Liu Ping Fan <pingfank@linux.vnet.ibm.com>
---
 drivers/pci/search.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/pci/search.c b/drivers/pci/search.c
index 827ad83..41a5738 100644
--- a/drivers/pci/search.c
+++ b/drivers/pci/search.c
@@ -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;
 }
-- 
1.8.1.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] pci: bugfix, pci_get_domain_bus_and_slot() needs to inc reference count
  2014-08-12  0:31 [PATCH] pci: bugfix, pci_get_domain_bus_and_slot() needs to inc reference count Liu Ping Fan
@ 2014-08-12  1:43 ` Yijing Wang
  2014-08-12  4:36   ` Liu ping fan
  0 siblings, 1 reply; 3+ messages in thread
From: Yijing Wang @ 2014-08-12  1:43 UTC (permalink / raw)
  To: Liu Ping Fan, linux-pci; +Cc: Bjorn Helgaas

On 2014/8/12 8:31, Liu Ping Fan wrote:
> 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)

> 
> Signed-off-by: Liu Ping Fan <pingfank@linux.vnet.ibm.com>
> ---
>  drivers/pci/search.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/pci/search.c b/drivers/pci/search.c
> index 827ad83..41a5738 100644
> --- a/drivers/pci/search.c
> +++ b/drivers/pci/search.c
> @@ -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;
>  }
> 


-- 
Thanks!
Yijing


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] pci: bugfix, pci_get_domain_bus_and_slot() needs to inc reference count
  2014-08-12  1:43 ` Yijing Wang
@ 2014-08-12  4:36   ` Liu ping fan
  0 siblings, 0 replies; 3+ messages in thread
From: Liu ping fan @ 2014-08-12  4:36 UTC (permalink / raw)
  To: Yijing Wang; +Cc: linux-pci, Bjorn Helgaas

On Tue, Aug 12, 2014 at 9:43 AM, Yijing Wang <wangyijing@huawei.com> wrote:
> On 2014/8/12 8:31, Liu Ping Fan wrote:
>> 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!
>>
>> Signed-off-by: Liu Ping Fan <pingfank@linux.vnet.ibm.com>
>> ---
>>  drivers/pci/search.c | 4 +++-
>>  1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/pci/search.c b/drivers/pci/search.c
>> index 827ad83..41a5738 100644
>> --- a/drivers/pci/search.c
>> +++ b/drivers/pci/search.c
>> @@ -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;
>>  }
>>
>
>
> --
> Thanks!
> Yijing
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-08-12  4:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-12  0:31 [PATCH] pci: bugfix, pci_get_domain_bus_and_slot() needs to inc reference count Liu Ping Fan
2014-08-12  1:43 ` Yijing Wang
2014-08-12  4:36   ` Liu ping fan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.