[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20080911103746.GB8795@ldl.fc.hp.com>
Date: Thu, 11 Sep 2008 04:37:46 -0600
From: Alex Chiang <achiang@...com>
To: Kenji Kaneshige <kaneshige.kenji@...fujitsu.com>
Cc: linux-pci@...r.kernel.org, linux-kernel@...r.kernel.org,
jbarnes@...tuousgeek.org, kristen.c.accardi@...el.com,
matthew@....cx
Subject: Re: [PATCH v2 02/13] PCI: prevent duplicate slot names
* Kenji Kaneshige <kaneshige.kenji@...fujitsu.com>:
> Alex Chiang wrote:
>> @@ -570,9 +571,17 @@ int pci_hp_register(struct hotplug_slot *slot, struct pci_bus *bus, int slot_nr,
>> return -EINVAL;
>> }
>> - /* Check if we have already registered a slot with the same name. */
>> - if (get_slot_from_name(name))
>> - return -EEXIST;
>> + /*
>> + * If we find a tmp_slot here, it means that another slot
>> + * driver has already created a pci_slot for this device.
>> + * We care (below) if the existing slot has a different name from
>> + * the new name that this particular hotplug driver is requesting.
>> + */
>> + dev = pci_get_slot(bus, PCI_DEVFN(slot_nr, 0));
>> + if (dev && dev->slot) {
>> + tmp_slot = dev->slot;
>> + pci_dev_put(dev);
>> + }
>>
>
> I have two comments here.
>
> (1) I think the reference counter of the device will be leaked if
> (dev == NULL) && (dev->slot != NULL). We need pci_dev_put() whenever
> dev is not NULL.
You're right, thank you.
[one day, I _will_ learn how to get refcounting correct. :-/]
> (2) When the slot is empty, the 'dev' will be always NULL. Therefore,
> 'tmp_slot' will be always NULL on the empty slot here. Because of
> this, the following code to rename the slot will not work on the
> empty slot, I think.
Ok, I was trying to avoid creating a new interface called
"pci_find_phys_slot()" or something similar, but I think we need
it, and it will fix this issue.
Thanks again for the review.
/ac
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists