Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit edf68da3 authored by Quentin Perret's avatar Quentin Perret Committed by Alistair Strachan
Browse files

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: d326aa36 ("ANDROID: PM / OPP: cpufreq-dt: Move power
estimation function")
Change-Id: I860b00a78710b543c5f3746f3ef35179de22ff01
Signed-off-by: default avatarQuentin Perret <quentin.perret@arm.com>
parent 2e0d7ea4
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -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;