]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
clk: renesas: r9a06g032: Fix memory leak in error path
authorHaotian Zhang <vulab@iscas.ac.cn>
Thu, 30 Oct 2025 06:16:03 +0000 (14:16 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 18 Dec 2025 13:02:57 +0000 (14:02 +0100)
commit8cacdb0f0bca048bcffd1b8c48a3daa40dcae3a6
tree39fe854c58cf5d5c566a7501377f0c1bc597ca8c
parent0dcbf7d6e9015447dfed6b3616ecef163e5e0fd8
clk: renesas: r9a06g032: Fix memory leak in error path

[ Upstream commit f8def051bbcf8677f64701e9699bf6d11e2780cd ]

The current code uses of_iomap() to map registers but never calls
iounmap() on any error path after the mapping. This causes a memory
leak when probe fails after successful ioremap, for example when
of_clk_add_provider() or r9a06g032_add_clk_domain() fails.

Replace of_iomap() with devm_of_iomap() to automatically unmap the
region on probe failure. Update the error check accordingly to use
IS_ERR() and PTR_ERR() since devm_of_iomap() returns ERR_PTR on error.

Fixes: 4c3d88526eba ("clk: renesas: Renesas R9A06G032 clock driver")
Signed-off-by: Haotian Zhang <vulab@iscas.ac.cn>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://patch.msgid.link/20251030061603.1954-1-vulab@iscas.ac.cn
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/clk/renesas/r9a06g032-clocks.c