mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-28 13:22:57 +00:00
PM / devfreq: exynos-ppmu: Fix refcount leak in of_get_devfreq_events
of_get_child_by_name() returns a node pointer with refcount
incremented, we should use of_node_put() on it when done.
This function only calls of_node_put() in normal path,
missing it in error paths.
Add missing of_node_put() to avoid refcount leak.
Fixes: f262f28c14
("PM / devfreq: event: Add devfreq_event class")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
This commit is contained in:
parent
20e6c3cc90
commit
f44b799603
1 changed files with 6 additions and 2 deletions
|
@ -519,15 +519,19 @@ static int of_get_devfreq_events(struct device_node *np,
|
||||||
|
|
||||||
count = of_get_child_count(events_np);
|
count = of_get_child_count(events_np);
|
||||||
desc = devm_kcalloc(dev, count, sizeof(*desc), GFP_KERNEL);
|
desc = devm_kcalloc(dev, count, sizeof(*desc), GFP_KERNEL);
|
||||||
if (!desc)
|
if (!desc) {
|
||||||
|
of_node_put(events_np);
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
}
|
||||||
info->num_events = count;
|
info->num_events = count;
|
||||||
|
|
||||||
of_id = of_match_device(exynos_ppmu_id_match, dev);
|
of_id = of_match_device(exynos_ppmu_id_match, dev);
|
||||||
if (of_id)
|
if (of_id)
|
||||||
info->ppmu_type = (enum exynos_ppmu_type)of_id->data;
|
info->ppmu_type = (enum exynos_ppmu_type)of_id->data;
|
||||||
else
|
else {
|
||||||
|
of_node_put(events_np);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
j = 0;
|
j = 0;
|
||||||
for_each_child_of_node(events_np, node) {
|
for_each_child_of_node(events_np, node) {
|
||||||
|
|
Loading…
Reference in a new issue