From: Michael Ellerman Date: Fri, 14 Sep 2007 05:33:13 +0000 (+1000) Subject: PCI: Fix incorrect argument order to list_add_tail() in PCI dynamic ID code X-Git-Tag: v2.6.24-rc1~1393^2~13 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a56bc69a182f501582557af7fad5bc882b1c856c;p=linux-2.6 PCI: Fix incorrect argument order to list_add_tail() in PCI dynamic ID 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 Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c index 004bc24872..c43ecedce6 100644 --- a/drivers/pci/pci-driver.c +++ b/drivers/pci/pci-driver.c @@ -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; @@ -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)) {