diff options
author | Jeffy Chen <jeffy.chen@rock-chips.com> | 2020-03-17 14:33:08 +0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2020-03-18 11:41:54 +0100 |
commit | 4dfff3d55440a9f8726a0f7d62a9c33594b58b10 (patch) | |
tree | eed11a0193821720ee31e5a5a9f4d2c6927b6036 /drivers/base | |
parent | 4a33691c4cea9eb0a7c66e87248be4637e14b180 (diff) |
arch_topology: Fix putting invalid cpu clk
Add a sanity check before putting the cpu clk.
Fixes: b8fe128dad8f (“arch_topology: Adjust initial CPU capacities with current freq")
Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
Link: https://lore.kernel.org/r/20200317063308.23209-1-jeffy.chen@rock-chips.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/base')
-rw-r--r-- | drivers/base/arch_topology.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/base/arch_topology.c b/drivers/base/arch_topology.c index 4cb1616d3871..e5d691cf824c 100644 --- a/drivers/base/arch_topology.c +++ b/drivers/base/arch_topology.c @@ -164,11 +164,11 @@ bool __init topology_parse_cpu_capacity(struct device_node *cpu_node, int cpu) * frequency (by keeping the initial freq_factor value). */ cpu_clk = of_clk_get(cpu_node, 0); - if (!PTR_ERR_OR_ZERO(cpu_clk)) + if (!PTR_ERR_OR_ZERO(cpu_clk)) { per_cpu(freq_factor, cpu) = clk_get_rate(cpu_clk) / 1000; - - clk_put(cpu_clk); + clk_put(cpu_clk); + } } else { if (raw_capacity) { pr_err("cpu_capacity: missing %pOF raw capacity\n", |