* [PATCH] EDAC/i10nm: fix refcount leak in pci_get_dev_wrapper()
@ 2022-11-17 7:26 Yang Yingliang
2022-11-28 5:48 ` Zhuo, Qiuxu
0 siblings, 1 reply; 2+ messages in thread
From: Yang Yingliang @ 2022-11-17 7:26 UTC (permalink / raw)
To: linux-edac; +Cc: tony.luck, bp, mchehab, james.morse, rric, yangyingliang
As comment of pci_get_domain_bus_and_slot() says, it returns
a pci device with refcount increment, so it don't need call
an extra pci_dev_get() in pci_get_dev_wrapper(), and the pci
device need be put in the error path.
Fixes: d4dc89d069aa ("EDAC, i10nm: Add a driver for Intel 10nm server processors")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
drivers/edac/i10nm_base.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/edac/i10nm_base.c b/drivers/edac/i10nm_base.c
index a22ea053f8e1..8af4d2523194 100644
--- a/drivers/edac/i10nm_base.c
+++ b/drivers/edac/i10nm_base.c
@@ -304,11 +304,10 @@ static struct pci_dev *pci_get_dev_wrapper(int dom, unsigned int bus,
if (unlikely(pci_enable_device(pdev) < 0)) {
edac_dbg(2, "Failed to enable device %02x:%02x.%x\n",
bus, dev, fun);
+ pci_dev_put(pdev);
return NULL;
}
- pci_dev_get(pdev);
-
return pdev;
}
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* RE: [PATCH] EDAC/i10nm: fix refcount leak in pci_get_dev_wrapper()
2022-11-17 7:26 [PATCH] EDAC/i10nm: fix refcount leak in pci_get_dev_wrapper() Yang Yingliang
@ 2022-11-28 5:48 ` Zhuo, Qiuxu
0 siblings, 0 replies; 2+ messages in thread
From: Zhuo, Qiuxu @ 2022-11-28 5:48 UTC (permalink / raw)
To: Yang Yingliang, linux-edac; +Cc: Luck, Tony, bp, mchehab, james.morse, rric
Need to fix the grammar errors in the commit message.
Otherwise LGTM.
-Qiuxu
> From: Yang Yingliang <yangyingliang@huawei.com>
> Sent: Thursday, November 17, 2022 3:26 PM
> To: linux-edac@vger.kernel.org
> Cc: Luck, Tony <tony.luck@intel.com>; bp@alien8.de; mchehab@kernel.org;
> james.morse@arm.com; rric@kernel.org; yangyingliang@huawei.com
> Subject: [PATCH] EDAC/i10nm: fix refcount leak in pci_get_dev_wrapper()
>
> As comment of pci_get_domain_bus_and_slot() says, it returns a pci device
s/comment/the comment
s/pci/PCI
> with refcount increment, so it don't need call an extra pci_dev_get() in
s/increment/incremented
s/don't need/doesn't need to
> pci_get_dev_wrapper(), and the pci device need be put in the error path.
s/pci/PCI
s/need/needs to be
> Fixes: d4dc89d069aa ("EDAC, i10nm: Add a driver for Intel 10nm server
> processors")
> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
> ---
> drivers/edac/i10nm_base.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/edac/i10nm_base.c b/drivers/edac/i10nm_base.c index
> a22ea053f8e1..8af4d2523194 100644
> --- a/drivers/edac/i10nm_base.c
> +++ b/drivers/edac/i10nm_base.c
> @@ -304,11 +304,10 @@ static struct pci_dev *pci_get_dev_wrapper(int
> dom, unsigned int bus,
> if (unlikely(pci_enable_device(pdev) < 0)) {
> edac_dbg(2, "Failed to enable device %02x:%02x.%x\n",
> bus, dev, fun);
> + pci_dev_put(pdev);
> return NULL;
> }
>
> - pci_dev_get(pdev);
> -
> return pdev;
> }
>
> --
> 2.25.1
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-11-28 5:49 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-17 7:26 [PATCH] EDAC/i10nm: fix refcount leak in pci_get_dev_wrapper() Yang Yingliang
2022-11-28 5:48 ` Zhuo, Qiuxu
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.