PM / devfreq: exynos-ppmu: Fix refcount leak in of_get_devfreq_events
authorMiaoqian Lin <linmq006@gmail.com>
Thu, 26 May 2022 08:28:56 +0000 (12:28 +0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 7 Jul 2022 15:53:27 +0000 (17:53 +0200)
commit01121e39ef537289926ae6f5374dce92c796d863
tree1a983f6c9991f59001b9a99f00215d2319d2be60
parent7cf7ed8f23c4e451a109b187fa12e071e98b9968
PM / devfreq: exynos-ppmu: Fix refcount leak in of_get_devfreq_events

commit f44b799603a9b5d2e375b0b2d54dd0b791eddfc2 upstream.

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: f262f28c1470 ("PM / devfreq: event: Add devfreq_event class")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/devfreq/event/exynos-ppmu.c