]> git.baikalelectronics.ru Git - kernel.git/commit
ptp_qoriq: fix memory leak in probe()
authorSongJingyi <u201912584@hust.edu.cn>
Fri, 24 Mar 2023 03:14:06 +0000 (11:14 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 5 Apr 2023 09:16:43 +0000 (11:16 +0200)
commit844347d391c356db40eb26b1986c37b0e7259880
tree13bcd9f9c6337b310efddd2be4cbfab87a7207db
parentb3ed02cc8ca8225b9a86d54baea1d3d958e11718
ptp_qoriq: fix memory leak in probe()

[ Upstream commit f33642224e38d7e0d59336e10e7b4e370b1c4506 ]

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: 456bb3f9cc32 ("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>
Link: https://lore.kernel.org/r/20230324031406.1895159-1-u201912584@hust.edu.cn
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/ptp/ptp_qoriq.c