Skip to content

Commit 9c89215

Browse files
Yang Yingliangaegl
authored andcommitted
EDAC/i10nm: fix refcount leak in pci_get_dev_wrapper()
As the comment of pci_get_domain_bus_and_slot() says, it returns a PCI device with refcount incremented, so it doesn't need to call an extra pci_dev_get() in pci_get_dev_wrapper(), and the PCI device needs to be put in the error path. Fixes: d4dc89d ("EDAC, i10nm: Add a driver for Intel 10nm server processors") Signed-off-by: Yang Yingliang <yangyingliang@huawei.com> Reviewed-by: Qiuxu Zhuo <qiuxu.zhuo@intel.com> Signed-off-by: Tony Luck <tony.luck@intel.com> Link: https://lore.kernel.org/r/20221128065512.3572550-1-yangyingliang@huawei.com
1 parent b586a59 commit 9c89215

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

drivers/edac/i10nm_base.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -304,11 +304,10 @@ static struct pci_dev *pci_get_dev_wrapper(int dom, unsigned int bus,
304304
if (unlikely(pci_enable_device(pdev) < 0)) {
305305
edac_dbg(2, "Failed to enable device %02x:%02x.%x\n",
306306
bus, dev, fun);
307+
pci_dev_put(pdev);
307308
return NULL;
308309
}
309310

310-
pci_dev_get(pdev);
311-
312311
return pdev;
313312
}
314313

0 commit comments

Comments
 (0)