* [PATCH] ptp: ocp: Fix a resource leak in an error handling path
@ 2021-05-12 11:15 Christophe JAILLET
2021-05-12 14:36 ` Richard Cochran
2021-05-12 21:10 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 3+ messages in thread
From: Christophe JAILLET @ 2021-05-12 11:15 UTC (permalink / raw)
To: richardcochran, kuba, jonathan.lemon
Cc: netdev, linux-kernel, kernel-janitors, Christophe JAILLET
If an error occurs after a successful 'pci_ioremap_bar()' call, it must be
undone by a corresponding 'pci_iounmap()' call, as already done in the
remove function.
Fixes: a7e1abad13f3 ("ptp: Add clock driver for the OpenCompute TimeCard.")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
drivers/ptp/ptp_ocp.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/ptp/ptp_ocp.c b/drivers/ptp/ptp_ocp.c
index 530e5f90095e..0d1034e3ed0f 100644
--- a/drivers/ptp/ptp_ocp.c
+++ b/drivers/ptp/ptp_ocp.c
@@ -324,7 +324,7 @@ ptp_ocp_probe(struct pci_dev *pdev, const struct pci_device_id *id)
if (!bp->base) {
dev_err(&pdev->dev, "io_remap bar0\n");
err = -ENOMEM;
- goto out;
+ goto out_release_regions;
}
bp->reg = bp->base + OCP_REGISTER_OFFSET;
bp->tod = bp->base + TOD_REGISTER_OFFSET;
@@ -347,6 +347,8 @@ ptp_ocp_probe(struct pci_dev *pdev, const struct pci_device_id *id)
return 0;
out:
+ pci_iounmap(pdev, bp->base);
+out_release_regions:
pci_release_regions(pdev);
out_disable:
pci_disable_device(pdev);
--
2.30.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] ptp: ocp: Fix a resource leak in an error handling path
2021-05-12 11:15 [PATCH] ptp: ocp: Fix a resource leak in an error handling path Christophe JAILLET
@ 2021-05-12 14:36 ` Richard Cochran
2021-05-12 21:10 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: Richard Cochran @ 2021-05-12 14:36 UTC (permalink / raw)
To: Christophe JAILLET
Cc: kuba, jonathan.lemon, netdev, linux-kernel, kernel-janitors
On Wed, May 12, 2021 at 01:15:29PM +0200, Christophe JAILLET wrote:
> If an error occurs after a successful 'pci_ioremap_bar()' call, it must be
> undone by a corresponding 'pci_iounmap()' call, as already done in the
> remove function.
>
> Fixes: a7e1abad13f3 ("ptp: Add clock driver for the OpenCompute TimeCard.")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Acked-by: Richard Cochran <richardcochran@gmail.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] ptp: ocp: Fix a resource leak in an error handling path
2021-05-12 11:15 [PATCH] ptp: ocp: Fix a resource leak in an error handling path Christophe JAILLET
2021-05-12 14:36 ` Richard Cochran
@ 2021-05-12 21:10 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-05-12 21:10 UTC (permalink / raw)
To: Christophe JAILLET
Cc: richardcochran, kuba, jonathan.lemon, netdev, linux-kernel,
kernel-janitors
Hello:
This patch was applied to netdev/net.git (refs/heads/master):
On Wed, 12 May 2021 13:15:29 +0200 you wrote:
> If an error occurs after a successful 'pci_ioremap_bar()' call, it must be
> undone by a corresponding 'pci_iounmap()' call, as already done in the
> remove function.
>
> Fixes: a7e1abad13f3 ("ptp: Add clock driver for the OpenCompute TimeCard.")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
>
> [...]
Here is the summary with links:
- ptp: ocp: Fix a resource leak in an error handling path
https://git.kernel.org/netdev/net/c/9c1bb37f8cad
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-05-12 22:19 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-12 11:15 [PATCH] ptp: ocp: Fix a resource leak in an error handling path Christophe JAILLET
2021-05-12 14:36 ` Richard Cochran
2021-05-12 21:10 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).