Skip to content

Commit 4dfff3d

Browse files
JeffyCNgregkh
authored andcommitted
arch_topology: Fix putting invalid cpu clk
Add a sanity check before putting the cpu clk. Fixes: b8fe128 (“arch_topology: Adjust initial CPU capacities with current freq") Signed-off-by: Jeffy Chen <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 4a33691 commit 4dfff3d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

drivers/base/arch_topology.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,11 +164,11 @@ bool __init topology_parse_cpu_capacity(struct device_node *cpu_node, int cpu)
164164
* frequency (by keeping the initial freq_factor value).
165165
*/
166166
cpu_clk = of_clk_get(cpu_node, 0);
167-
if (!PTR_ERR_OR_ZERO(cpu_clk))
167+
if (!PTR_ERR_OR_ZERO(cpu_clk)) {
168168
per_cpu(freq_factor, cpu) =
169169
clk_get_rate(cpu_clk) / 1000;
170-
171-
clk_put(cpu_clk);
170+
clk_put(cpu_clk);
171+
}
172172
} else {
173173
if (raw_capacity) {
174174
pr_err("cpu_capacity: missing %pOF raw capacity\n",

0 commit comments

Comments
 (0)