From edf68da31b71da3d9d1a04c2d59b50722defad5e Mon Sep 17 00:00:00 2001 From: Quentin Perret Date: Wed, 19 Dec 2018 17:08:40 +0000 Subject: [PATCH] ANDROID: PM / OPP: Add missing of_node_put() to power estimation helper of_dev_pm_get_cpu_power() fails to properly decrement the refcount of the device_node used to read the CPU capacitance. Fix this. Bug: 120440300 Fixes: d326aa36e63a ("ANDROID: PM / OPP: cpufreq-dt: Move power estimation function") Change-Id: I860b00a78710b543c5f3746f3ef35179de22ff01 Signed-off-by: Quentin Perret --- drivers/opp/of.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/opp/of.c b/drivers/opp/of.c index 9afe90fdcb51..3d4ec2fad051 100644 --- a/drivers/opp/of.c +++ b/drivers/opp/of.c @@ -787,6 +787,7 @@ int of_dev_pm_opp_get_cpu_power(unsigned long *mW, unsigned long *KHz, int cpu) struct device_node *np; u32 cap; u64 tmp; + int ret; cpu_dev = get_cpu_device(cpu); if (!cpu_dev) @@ -796,7 +797,9 @@ int of_dev_pm_opp_get_cpu_power(unsigned long *mW, unsigned long *KHz, int cpu) if (!np) return -EINVAL; - if (of_property_read_u32(np, "dynamic-power-coefficient", &cap)) + ret = of_property_read_u32(np, "dynamic-power-coefficient", &cap); + of_node_put(np); + if (ret) return -EINVAL; Hz = *KHz * 1000;