提交 f3364222 编写于 作者: S SongJingyi 提交者: Jakub Kicinski

ptp_qoriq: fix memory leak in probe()

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: 7f4399ba ("ptp_qoriq: fix NULL access if ptp dt node missing")
Signed-off-by: NSongJingyi <u201912584@hust.edu.cn>
Reviewed-by: NDan Carpenter <error27@gmail.com>
Reviewed-by: NDongliang Mu <dzm91@hust.edu.cn>
Link: https://lore.kernel.org/r/20230324031406.1895159-1-u201912584@hust.edu.cnSigned-off-by: NJakub Kicinski <kuba@kernel.org>
上级 3bced313
...@@ -637,7 +637,7 @@ static int ptp_qoriq_probe(struct platform_device *dev) ...@@ -637,7 +637,7 @@ static int ptp_qoriq_probe(struct platform_device *dev)
return 0; return 0;
no_clock: no_clock:
iounmap(ptp_qoriq->base); iounmap(base);
no_ioremap: no_ioremap:
release_resource(ptp_qoriq->rsrc); release_resource(ptp_qoriq->rsrc);
no_resource: no_resource:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册