Commit ce364c0d authored by Fei Shao's avatar Fei Shao Committed by Lee Jones
Browse files

UPSTREAM: clk: Fix memory leak in devm_clk_notifier_register()



devm_clk_notifier_register() allocates a devres resource for clk
notifier but didn't register that to the device, so the notifier didn't
get unregistered on device detach and the allocated resource was leaked.

Fix the issue by registering the resource through devres_add().

This issue was found with kmemleak on a Chromebook.

Bug: 254441685
Fixes: 6d30d50d ("clk: add devm variant of clk_notifier_register")
Signed-off-by: default avatarFei Shao <fshao@chromium.org>
Link: https://lore.kernel.org/r/20230619112253.v2.1.I13f060c10549ef181603e921291bdea95f83033c@changeid


Reviewed-by: default avatarDan Carpenter <dan.carpenter@linaro.org>
Signed-off-by: default avatarStephen Boyd <sboyd@kernel.org>
(cherry picked from commit 7fb933e5)
Signed-off-by: default avatarLee Jones <joneslee@google.com>
Change-Id: I5f9b23708576bd2344e5ac79546d5a1ca5dc943d
parent eebfedfd
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment