提交 a56bc69a 编写于 作者: M Michael Ellerman 提交者: Greg Kroah-Hartman

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/10Signed-off-by: NMichael Ellerman <michael@ellerman.id.au>
Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
上级 5b1ea82f
...@@ -54,7 +54,6 @@ store_new_id(struct device_driver *driver, const char *buf, size_t count) ...@@ -54,7 +54,6 @@ store_new_id(struct device_driver *driver, const char *buf, size_t count)
if (!dynid) if (!dynid)
return -ENOMEM; return -ENOMEM;
INIT_LIST_HEAD(&dynid->node);
dynid->id.vendor = vendor; dynid->id.vendor = vendor;
dynid->id.device = device; dynid->id.device = device;
dynid->id.subvendor = subvendor; dynid->id.subvendor = subvendor;
...@@ -65,7 +64,7 @@ store_new_id(struct device_driver *driver, const char *buf, size_t count) ...@@ -65,7 +64,7 @@ store_new_id(struct device_driver *driver, const char *buf, size_t count)
driver_data : 0UL; driver_data : 0UL;
spin_lock(&pdrv->dynids.lock); 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); spin_unlock(&pdrv->dynids.lock);
if (get_driver(&pdrv->driver)) { if (get_driver(&pdrv->driver)) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册