Skip to content

Commit 2d56427

Browse files
committed
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
2 parents e6b95ef + d9db393 commit 2d56427

File tree

4 files changed

+20
-23
lines changed

4 files changed

+20
-23
lines changed

drivers/pci/hotplug/pci_hotplug_core.c

+1-7
Original file line numberDiff line numberDiff line change
@@ -388,8 +388,8 @@ static struct hotplug_slot *get_slot_from_name(const char *name)
388388

389389
/**
390390
* __pci_hp_register - register a hotplug_slot with the PCI hotplug subsystem
391-
* @bus: bus this slot is on
392391
* @slot: pointer to the &struct hotplug_slot to register
392+
* @bus: bus this slot is on
393393
* @devnr: device number
394394
* @name: name registered with kobject core
395395
* @owner: caller module owner
@@ -498,8 +498,6 @@ EXPORT_SYMBOL_GPL(pci_hp_add);
498498
*
499499
* The @slot must have been registered with the pci hotplug subsystem
500500
* previously with a call to pci_hp_register().
501-
*
502-
* Returns 0 if successful, anything else for an error.
503501
*/
504502
void pci_hp_deregister(struct hotplug_slot *slot)
505503
{
@@ -513,8 +511,6 @@ EXPORT_SYMBOL_GPL(pci_hp_deregister);
513511
* @slot: pointer to the &struct hotplug_slot to unpublish
514512
*
515513
* Remove a hotplug slot's sysfs interface.
516-
*
517-
* Returns 0 on success or a negative int on error.
518514
*/
519515
void pci_hp_del(struct hotplug_slot *slot)
520516
{
@@ -545,8 +541,6 @@ EXPORT_SYMBOL_GPL(pci_hp_del);
545541
* the driver may no longer invoke hotplug_slot_name() to get the slot's
546542
* unique name. The driver no longer needs to handle a ->reset_slot callback
547543
* from this point on.
548-
*
549-
* Returns 0 on success or a negative int on error.
550544
*/
551545
void pci_hp_destroy(struct hotplug_slot *slot)
552546
{

drivers/pci/pci.c

+3-2
Original file line numberDiff line numberDiff line change
@@ -5250,7 +5250,7 @@ static ssize_t reset_method_store(struct device *dev,
52505250
const char *buf, size_t count)
52515251
{
52525252
struct pci_dev *pdev = to_pci_dev(dev);
5253-
char *options, *name;
5253+
char *options, *tmp_options, *name;
52545254
int m, n;
52555255
u8 reset_methods[PCI_NUM_RESET_METHODS] = { 0 };
52565256

@@ -5270,7 +5270,8 @@ static ssize_t reset_method_store(struct device *dev,
52705270
return -ENOMEM;
52715271

52725272
n = 0;
5273-
while ((name = strsep(&options, " ")) != NULL) {
5273+
tmp_options = options;
5274+
while ((name = strsep(&tmp_options, " ")) != NULL) {
52745275
if (sysfs_streq(name, ""))
52755276
continue;
52765277

drivers/pci/slot.c

+11-9
Original file line numberDiff line numberDiff line change
@@ -245,12 +245,13 @@ struct pci_slot *pci_create_slot(struct pci_bus *parent, int slot_nr,
245245
slot = get_slot(parent, slot_nr);
246246
if (slot) {
247247
if (hotplug) {
248-
if ((err = slot->hotplug ? -EBUSY : 0)
249-
|| (err = rename_slot(slot, name))) {
250-
kobject_put(&slot->kobj);
251-
slot = NULL;
252-
goto err;
248+
if (slot->hotplug) {
249+
err = -EBUSY;
250+
goto put_slot;
253251
}
252+
err = rename_slot(slot, name);
253+
if (err)
254+
goto put_slot;
254255
}
255256
goto out;
256257
}
@@ -280,10 +281,8 @@ struct pci_slot *pci_create_slot(struct pci_bus *parent, int slot_nr,
280281

281282
err = kobject_init_and_add(&slot->kobj, &pci_slot_ktype, NULL,
282283
"%s", slot_name);
283-
if (err) {
284-
kobject_put(&slot->kobj);
285-
goto err;
286-
}
284+
if (err)
285+
goto put_slot;
287286

288287
down_read(&pci_bus_sem);
289288
list_for_each_entry(dev, &parent->devices, bus_list)
@@ -298,6 +297,9 @@ struct pci_slot *pci_create_slot(struct pci_bus *parent, int slot_nr,
298297
kfree(slot_name);
299298
mutex_unlock(&pci_slot_mutex);
300299
return slot;
300+
301+
put_slot:
302+
kobject_put(&slot->kobj);
301303
err:
302304
slot = ERR_PTR(err);
303305
goto out;

tools/pci/pcitest.c

+5-5
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ static int run_test(struct pci_test *test)
9595

9696
if (test->msinum > 0 && test->msinum <= 32) {
9797
ret = ioctl(fd, PCITEST_MSI, test->msinum);
98-
fprintf(stdout, "MSI%d:\t\t", test->msinum);
98+
fprintf(stdout, "MSI%u:\t\t", test->msinum);
9999
if (ret < 0)
100100
fprintf(stdout, "TEST FAILED\n");
101101
else
@@ -104,7 +104,7 @@ static int run_test(struct pci_test *test)
104104

105105
if (test->msixnum > 0 && test->msixnum <= 2048) {
106106
ret = ioctl(fd, PCITEST_MSIX, test->msixnum);
107-
fprintf(stdout, "MSI-X%d:\t\t", test->msixnum);
107+
fprintf(stdout, "MSI-X%u:\t\t", test->msixnum);
108108
if (ret < 0)
109109
fprintf(stdout, "TEST FAILED\n");
110110
else
@@ -116,7 +116,7 @@ static int run_test(struct pci_test *test)
116116
if (test->use_dma)
117117
param.flags = PCITEST_FLAGS_USE_DMA;
118118
ret = ioctl(fd, PCITEST_WRITE, &param);
119-
fprintf(stdout, "WRITE (%7ld bytes):\t\t", test->size);
119+
fprintf(stdout, "WRITE (%7lu bytes):\t\t", test->size);
120120
if (ret < 0)
121121
fprintf(stdout, "TEST FAILED\n");
122122
else
@@ -128,7 +128,7 @@ static int run_test(struct pci_test *test)
128128
if (test->use_dma)
129129
param.flags = PCITEST_FLAGS_USE_DMA;
130130
ret = ioctl(fd, PCITEST_READ, &param);
131-
fprintf(stdout, "READ (%7ld bytes):\t\t", test->size);
131+
fprintf(stdout, "READ (%7lu bytes):\t\t", test->size);
132132
if (ret < 0)
133133
fprintf(stdout, "TEST FAILED\n");
134134
else
@@ -140,7 +140,7 @@ static int run_test(struct pci_test *test)
140140
if (test->use_dma)
141141
param.flags = PCITEST_FLAGS_USE_DMA;
142142
ret = ioctl(fd, PCITEST_COPY, &param);
143-
fprintf(stdout, "COPY (%7ld bytes):\t\t", test->size);
143+
fprintf(stdout, "COPY (%7lu bytes):\t\t", test->size);
144144
if (ret < 0)
145145
fprintf(stdout, "TEST FAILED\n");
146146
else

0 commit comments

Comments
 (0)