summaryrefslogtreecommitdiff
path: root/drivers/of
diff options
context:
space:
mode:
authorZijun Hu <quic_zijuhu@quicinc.com>2025-01-09 16:27:01 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-02-21 15:49:17 +0300
commitf1142d4e7a35d990e59308413d00a3451b46aca9 (patch)
treef8313dff7eee7aa2a02b206174607e79249d666c /drivers/of
parent8b102f46eaeb02640a6f67ec0ad7d69cfe7afa75 (diff)
downloadlinux-f1142d4e7a35d990e59308413d00a3451b46aca9.tar.xz
of: reserved-memory: Do not make kmemleak ignore freed address
[ Upstream commit 29091a52562bca4d6e678dd8f0085dac119d6a21 ] early_init_dt_alloc_reserved_memory_arch() will free address @base when suffers memblock_mark_nomap() error, but it still makes kmemleak ignore the freed address @base via kmemleak_ignore_phys(). That is unnecessary, besides, also causes unnecessary warning messages: kmemleak_ignore_phys() -> make_black_object() -> paint_ptr() -> kmemleak_warn() // warning message here. Fix by avoiding kmemleak_ignore_phys() when suffer the error. Fixes: 658aafc8139c ("memblock: exclude MEMBLOCK_NOMAP regions from kmemleak") Signed-off-by: Zijun Hu <quic_zijuhu@quicinc.com> Link: https://lore.kernel.org/r/20250109-of_core_fix-v4-10-db8a72415b8c@quicinc.com Signed-off-by: Rob Herring (Arm) <robh@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/of')
-rw-r--r--drivers/of/of_reserved_mem.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/of/of_reserved_mem.c b/drivers/of/of_reserved_mem.c
index f90975e00446..5a5d24eeb5f3 100644
--- a/drivers/of/of_reserved_mem.c
+++ b/drivers/of/of_reserved_mem.c
@@ -50,7 +50,8 @@ static int __init early_init_dt_alloc_reserved_memory_arch(phys_addr_t size,
memblock_phys_free(base, size);
}
- kmemleak_ignore_phys(base);
+ if (!err)
+ kmemleak_ignore_phys(base);
return err;
}