[PATCH v2, part 1 3/9] PCI: Convert alloc_pci_dev(void) to pci_alloc_dev(bus) instead
Gu Zheng
guz.fnst at cn.fujitsu.com
Tue May 14 18:26:38 EST 2013
On 05/14/2013 01:23 AM, Yinghai Lu wrote:
> On Mon, May 13, 2013 at 9:08 AM, Jiang Liu <liuj97 at gmail.com> wrote:
>> From: Gu Zheng <guz.fnst at cn.fujitsu.com>
>> diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
>> index 4f0bc0a..bc075a3 100644
>> --- a/drivers/pci/probe.c
>> +++ b/drivers/pci/probe.c
>> @@ -1131,6 +1131,7 @@ static void pci_release_dev(struct device *dev)
>> struct pci_dev *pci_dev;
>>
>> pci_dev = to_pci_dev(dev);
>> + pci_bus_put(pci_dev->bus);
>> pci_release_capabilities(pci_dev);
>> pci_release_of_node(pci_dev);
>> kfree(pci_dev);
>> @@ -1269,11 +1270,10 @@ static struct pci_dev *pci_scan_device(struct pci_bus *bus, int devfn)
>> if (!pci_bus_read_dev_vendor_id(bus, devfn, &l, 60*1000))
>> return NULL;
>>
>> - dev = alloc_pci_dev();
>> + dev = pci_alloc_dev(bus);
>> if (!dev)
>> return NULL;
>>
>> - dev->bus = bus;
>> dev->devfn = devfn;
>> dev->vendor = l & 0xffff;
>> dev->device = (l >> 16) & 0xffff;
>
> in pci_setup_device() fail path, it release the ref to that bus.
Yes, you're right, we need to release the bus' ref if pci_setup_device() failed.
Thanks for your correction.:)
Best regards,
Gu
>
> Yinghai
>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: Convert-alloc_pci_dev-void-to-pci_alloc_dev-v3.patch
URL: <http://lists.ozlabs.org/pipermail/linuxppc-dev/attachments/20130514/7b71aed5/attachment.ksh>
More information about the Linuxppc-dev
mailing list