Skip to content

Commit

Permalink
PCI: Fix incorrect argument order to list_add_tail() in PCI dynamic I…
Browse files Browse the repository at this point in the history
…D code

The code for dynamically assigning new ids to PCI drivers,
store_new_id(), calls list_add_tail() with the list head and new node
arguments in reversed order.

The result is that every new id written essentially overwrites the
previous list of ids.

Caught with the help of Rusty's "horribly bad" list_node patch:
 http://lkml.org/lkml/2007/6/10/10

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Michael Ellerman authored and Greg Kroah-Hartman committed Oct 12, 2007
1 parent 5b1ea82 commit a56bc69
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions drivers/pci/pci-driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ store_new_id(struct device_driver *driver, const char *buf, size_t count)
if (!dynid)
return -ENOMEM;

INIT_LIST_HEAD(&dynid->node);
dynid->id.vendor = vendor;
dynid->id.device = device;
dynid->id.subvendor = subvendor;
Expand All @@ -65,7 +64,7 @@ store_new_id(struct device_driver *driver, const char *buf, size_t count)
driver_data : 0UL;

spin_lock(&pdrv->dynids.lock);
list_add_tail(&pdrv->dynids.list, &dynid->node);
list_add_tail(&dynid->node, &pdrv->dynids.list);
spin_unlock(&pdrv->dynids.lock);

if (get_driver(&pdrv->driver)) {
Expand Down

0 comments on commit a56bc69

Please sign in to comment.