diff options
Diffstat (limited to 'drivers/pci/msi.c')
-rw-r--r-- | drivers/pci/msi.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c index 337e16ab4a92..82de95ec2ea0 100644 --- a/drivers/pci/msi.c +++ b/drivers/pci/msi.c @@ -323,8 +323,18 @@ static void free_msi_irqs(struct pci_dev *dev) if (list_is_last(&entry->list, &dev->msi_list)) iounmap(entry->mask_base); } - kobject_del(&entry->kobj); - kobject_put(&entry->kobj); + + /* + * Its possible that we get into this path + * When populate_msi_sysfs fails, which means the entries + * were not registered with sysfs. In that case don't + * unregister them. + */ + if (entry->kobj.parent) { + kobject_del(&entry->kobj); + kobject_put(&entry->kobj); + } + list_del(&entry->list); kfree(entry); } |