mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-15 00:04:15 +08:00
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.
Fixes: 6d30d50d03
("clk: add devm variant of clk_notifier_register")
Signed-off-by: Fei Shao <fshao@chromium.org>
Link: https://lore.kernel.org/r/20230619112253.v2.1.I13f060c10549ef181603e921291bdea95f83033c@changeid
Reviewed-by: Dan Carpenter <dan.carpenter@linaro.org>
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
This commit is contained in:
parent
bd73d1fd63
commit
7fb933e56f
@ -4695,6 +4695,7 @@ int devm_clk_notifier_register(struct device *dev, struct clk *clk,
|
|||||||
if (!ret) {
|
if (!ret) {
|
||||||
devres->clk = clk;
|
devres->clk = clk;
|
||||||
devres->nb = nb;
|
devres->nb = nb;
|
||||||
|
devres_add(dev, devres);
|
||||||
} else {
|
} else {
|
||||||
devres_free(devres);
|
devres_free(devres);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user