Merge branch 'pci/hotplug'

- Fix pci_create_slot() reference count leak in failure path (Qiushi Wu)

- Make rpadlpar functions static (Wei Yongjun)

* pci/hotplug:
  PCI: rpadlpar: Make functions static
  PCI: Fix pci_create_slot() reference count leak
This commit is contained in:
Bjorn Helgaas 2020-08-05 18:24:15 -05:00
commit e8c4a76524
2 changed files with 7 additions and 5 deletions

View File

@ -352,7 +352,7 @@ static int dlpar_remove_vio_slot(char *drc_name, struct device_node *dn)
* -ENODEV Not a valid drc_name
* -EIO Internal PCI Error
*/
int dlpar_remove_pci_slot(char *drc_name, struct device_node *dn)
static int dlpar_remove_pci_slot(char *drc_name, struct device_node *dn)
{
struct pci_bus *bus;
struct slot *slot;
@ -458,7 +458,7 @@ static inline int is_dlpar_capable(void)
return (int) (rc != RTAS_UNKNOWN_SERVICE);
}
int __init rpadlpar_io_init(void)
static int __init rpadlpar_io_init(void)
{
if (!is_dlpar_capable()) {
@ -470,7 +470,7 @@ int __init rpadlpar_io_init(void)
return dlpar_sysfs_init();
}
void rpadlpar_io_exit(void)
static void __exit rpadlpar_io_exit(void)
{
dlpar_sysfs_exit();
}

View File

@ -268,13 +268,16 @@ placeholder:
slot_name = make_slot_name(name);
if (!slot_name) {
err = -ENOMEM;
kfree(slot);
goto err;
}
err = kobject_init_and_add(&slot->kobj, &pci_slot_ktype, NULL,
"%s", slot_name);
if (err)
if (err) {
kobject_put(&slot->kobj);
goto err;
}
INIT_LIST_HEAD(&slot->list);
list_add(&slot->list, &parent->slots);
@ -293,7 +296,6 @@ out:
mutex_unlock(&pci_slot_mutex);
return slot;
err:
kfree(slot);
slot = ERR_PTR(err);
goto out;
}