diff options
author | Bjorn Helgaas <bhelgaas@google.com> | 2024-11-25 20:41:00 +0100 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2024-11-25 20:41:00 +0100 |
commit | 2d564279899028a98a854dbc78e2fdb7db4b4f00 (patch) | |
tree | 740a8870f2a06bfb6d7c8085c640a4bbc24c07f5 /drivers/pci | |
parent | Merge branch 'pci/controller/vmd' (diff) | |
parent | tools: PCI: Fix incorrect printf format specifiers (diff) | |
download | linux-2d564279899028a98a854dbc78e2fdb7db4b4f00.tar.xz linux-2d564279899028a98a854dbc78e2fdb7db4b4f00.zip |
Merge branch 'pci/misc'
- Reorganize kerneldoc parameter names to match order in function signature
(Julia Lawall)
- Remove kerneldoc return value descriptions from hotplug registration
interfaces that don't return anything (Ilpo Järvinen)
- Fix sysfs reset_method_store() memory leak (Todd Kjos)
- Simplify pci_create_slot() (Ilpo Järvinen)
- Fix incorrect printf format specifiers in pcitest (Luo Yifan)
* pci/misc:
tools: PCI: Fix incorrect printf format specifiers
PCI: Simplify pci_create_slot() logic
PCI: Fix reset_method_store() memory leak
PCI: hotplug: Remove "Returns" kerneldoc from void functions
PCI: hotplug: Reorganize kerneldoc parameter names
Diffstat (limited to 'drivers/pci')
-rw-r--r-- | drivers/pci/hotplug/pci_hotplug_core.c | 8 | ||||
-rw-r--r-- | drivers/pci/pci.c | 5 | ||||
-rw-r--r-- | drivers/pci/slot.c | 20 |
3 files changed, 15 insertions, 18 deletions
diff --git a/drivers/pci/hotplug/pci_hotplug_core.c b/drivers/pci/hotplug/pci_hotplug_core.c index 058d5937d8a9..36236ac88fd5 100644 --- a/drivers/pci/hotplug/pci_hotplug_core.c +++ b/drivers/pci/hotplug/pci_hotplug_core.c @@ -388,8 +388,8 @@ static struct hotplug_slot *get_slot_from_name(const char *name) /** * __pci_hp_register - register a hotplug_slot with the PCI hotplug subsystem - * @bus: bus this slot is on * @slot: pointer to the &struct hotplug_slot to register + * @bus: bus this slot is on * @devnr: device number * @name: name registered with kobject core * @owner: caller module owner @@ -498,8 +498,6 @@ EXPORT_SYMBOL_GPL(pci_hp_add); * * The @slot must have been registered with the pci hotplug subsystem * previously with a call to pci_hp_register(). - * - * Returns 0 if successful, anything else for an error. */ void pci_hp_deregister(struct hotplug_slot *slot) { @@ -513,8 +511,6 @@ EXPORT_SYMBOL_GPL(pci_hp_deregister); * @slot: pointer to the &struct hotplug_slot to unpublish * * Remove a hotplug slot's sysfs interface. - * - * Returns 0 on success or a negative int on error. */ void pci_hp_del(struct hotplug_slot *slot) { @@ -545,8 +541,6 @@ EXPORT_SYMBOL_GPL(pci_hp_del); * the driver may no longer invoke hotplug_slot_name() to get the slot's * unique name. The driver no longer needs to handle a ->reset_slot callback * from this point on. - * - * Returns 0 on success or a negative int on error. */ void pci_hp_destroy(struct hotplug_slot *slot) { diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 43c9a0e029c9..e278861684bc 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -5250,7 +5250,7 @@ static ssize_t reset_method_store(struct device *dev, const char *buf, size_t count) { struct pci_dev *pdev = to_pci_dev(dev); - char *options, *name; + char *options, *tmp_options, *name; int m, n; u8 reset_methods[PCI_NUM_RESET_METHODS] = { 0 }; @@ -5270,7 +5270,8 @@ static ssize_t reset_method_store(struct device *dev, return -ENOMEM; n = 0; - while ((name = strsep(&options, " ")) != NULL) { + tmp_options = options; + while ((name = strsep(&tmp_options, " ")) != NULL) { if (sysfs_streq(name, "")) continue; diff --git a/drivers/pci/slot.c b/drivers/pci/slot.c index ed645c7a4e4b..36b44be0489d 100644 --- a/drivers/pci/slot.c +++ b/drivers/pci/slot.c @@ -245,12 +245,13 @@ struct pci_slot *pci_create_slot(struct pci_bus *parent, int slot_nr, slot = get_slot(parent, slot_nr); if (slot) { if (hotplug) { - if ((err = slot->hotplug ? -EBUSY : 0) - || (err = rename_slot(slot, name))) { - kobject_put(&slot->kobj); - slot = NULL; - goto err; + if (slot->hotplug) { + err = -EBUSY; + goto put_slot; } + err = rename_slot(slot, name); + if (err) + goto put_slot; } goto out; } @@ -280,10 +281,8 @@ placeholder: err = kobject_init_and_add(&slot->kobj, &pci_slot_ktype, NULL, "%s", slot_name); - if (err) { - kobject_put(&slot->kobj); - goto err; - } + if (err) + goto put_slot; down_read(&pci_bus_sem); list_for_each_entry(dev, &parent->devices, bus_list) @@ -298,6 +297,9 @@ out: kfree(slot_name); mutex_unlock(&pci_slot_mutex); return slot; + +put_slot: + kobject_put(&slot->kobj); err: slot = ERR_PTR(err); goto out; |