提交 0bf01c3c 编写于 作者: J Jiri Slaby 提交者: Jesse Barnes

PCI: hotplug/cpcihp, fix pci device refcounting

Stanse found an ommitted pci_dev_put on one error path in
cpcihp_generic_init. The path is taken on !dev, but also when
dev->hdr_type != PCI_HEADER_TYPE_BRIDGE. However it omits to
pci_dev_put on the latter.

As it is fine to pass NULL to pci_dev_put, put it in there
uncoditionally.
Signed-off-by: NJiri Slaby <jslaby@suse.cz>
Cc: Scott Murray <scott@spiteful.org>
Signed-off-by: NJesse Barnes <jbarnes@virtuousgeek.org>
上级 41a68a74
...@@ -162,6 +162,7 @@ static int __init cpcihp_generic_init(void) ...@@ -162,6 +162,7 @@ static int __init cpcihp_generic_init(void)
dev = pci_get_slot(bus, PCI_DEVFN(bridge_slot, 0)); dev = pci_get_slot(bus, PCI_DEVFN(bridge_slot, 0));
if(!dev || dev->hdr_type != PCI_HEADER_TYPE_BRIDGE) { if(!dev || dev->hdr_type != PCI_HEADER_TYPE_BRIDGE) {
err("Invalid bridge device %s", bridge); err("Invalid bridge device %s", bridge);
pci_dev_put(dev);
return -EINVAL; return -EINVAL;
} }
bus = dev->subordinate; bus = dev->subordinate;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册