public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ptp_qoriq: fix memory leak in probe()
@ 2023-03-24  3:14 SongJingyi
  2023-03-25  2:20 ` patchwork-bot+netdevbpf
  0 siblings, 1 reply; 2+ messages in thread
From: SongJingyi @ 2023-03-24  3:14 UTC (permalink / raw)
  To: Yangbo Lu, Richard Cochran, David S. Miller, Claudiu Manoil
  Cc: hust-os-kernel-patches, SongJingyi, Dan Carpenter, Dongliang Mu,
	netdev, linux-kernel

Smatch complains that:
drivers/ptp/ptp_qoriq.c ptp_qoriq_probe()
warn: 'base' from ioremap() not released.

Fix this by revising the parameter from 'ptp_qoriq->base' to 'base'.
This is only a bug if ptp_qoriq_init() returns on the
first -ENODEV error path.
For other error paths ptp_qoriq->base and base are the same.
And this change makes the code more readable.

Fixes: 7f4399ba405b ("ptp_qoriq: fix NULL access if ptp dt node missing")
Signed-off-by: SongJingyi <u201912584@hust.edu.cn>
Reviewed-by: Dan Carpenter <error27@gmail.com>
Reviewed-by: Dongliang Mu <dzm91@hust.edu.cn>
---
 drivers/ptp/ptp_qoriq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/ptp/ptp_qoriq.c b/drivers/ptp/ptp_qoriq.c
index 61530167efe4..350154e4c2b5 100644
--- a/drivers/ptp/ptp_qoriq.c
+++ b/drivers/ptp/ptp_qoriq.c
@@ -637,7 +637,7 @@ static int ptp_qoriq_probe(struct platform_device *dev)
 	return 0;
 
 no_clock:
-	iounmap(ptp_qoriq->base);
+	iounmap(base);
 no_ioremap:
 	release_resource(ptp_qoriq->rsrc);
 no_resource:
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] ptp_qoriq: fix memory leak in probe()
  2023-03-24  3:14 [PATCH] ptp_qoriq: fix memory leak in probe() SongJingyi
@ 2023-03-25  2:20 ` patchwork-bot+netdevbpf
  0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-03-25  2:20 UTC (permalink / raw)
  To: SongJingyi
  Cc: yangbo.lu, richardcochran, davem, claudiu.manoil,
	hust-os-kernel-patches, error27, dzm91, netdev, linux-kernel

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Fri, 24 Mar 2023 11:14:06 +0800 you wrote:
> Smatch complains that:
> drivers/ptp/ptp_qoriq.c ptp_qoriq_probe()
> warn: 'base' from ioremap() not released.
> 
> Fix this by revising the parameter from 'ptp_qoriq->base' to 'base'.
> This is only a bug if ptp_qoriq_init() returns on the
> first -ENODEV error path.
> For other error paths ptp_qoriq->base and base are the same.
> And this change makes the code more readable.
> 
> [...]

Here is the summary with links:
  - ptp_qoriq: fix memory leak in probe()
    https://git.kernel.org/netdev/net/c/f33642224e38

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] 2+ messages in thread

end of thread, other threads:[~2023-03-25  2:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-24  3:14 [PATCH] ptp_qoriq: fix memory leak in probe() SongJingyi
2023-03-25  2:20 ` 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