Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

PM / OPP: add missing of_node_put() for of_get_cpu_node()

Commit 762792913f8c (PM / OPP: Fix get sharing CPUs when hotplug
is used) moved away from using cpu_dev->of_node because of some
limitations.

However, commit 7467c9d95989 (of: return of_get_cpu_node from
of_cpu_device_node_get if CPUs are not registered) added support to
fall back to of_get_cpu_node() if called if CPUs are not registered
yet.

Add the missing of_node_put() for the CPU device nodes. Also go back
to using of_cpu_device_node_get() in dev_pm_opp_of_get_sharing_cpus()
to avoid scanning the device tree again.

Acked-by: Viresh Kumar <vireshk@kernel.org>
Fixes: 762792913f8c (PM / OPP: Fix get sharing CPUs when hotplug is used)
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
Reviewed-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

authored by

Sudeep Holla and committed by
Rafael J. Wysocki
9867999f 604a7aeb

+3 -2
+3 -2
drivers/opp/of.c
··· 16 16 #include <linux/cpu.h> 17 17 #include <linux/errno.h> 18 18 #include <linux/device.h> 19 - #include <linux/of.h> 19 + #include <linux/of_device.h> 20 20 #include <linux/slab.h> 21 21 #include <linux/export.h> 22 22 ··· 604 604 if (cpu == cpu_dev->id) 605 605 continue; 606 606 607 - cpu_np = of_get_cpu_node(cpu, NULL); 607 + cpu_np = of_cpu_device_node_get(cpu); 608 608 if (!cpu_np) { 609 609 dev_err(cpu_dev, "%s: failed to get cpu%d node\n", 610 610 __func__, cpu); ··· 614 614 615 615 /* Get OPP descriptor node */ 616 616 tmp_np = _opp_of_get_opp_desc_node(cpu_np); 617 + of_node_put(cpu_np); 617 618 if (!tmp_np) { 618 619 pr_err("%pOF: Couldn't find opp node\n", cpu_np); 619 620 ret = -ENOENT;