Skip to content

Commit

Permalink
arch_topology: Fix putting invalid cpu clk
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
JeffyCN authored and gregkh committed Mar 18, 2020
1 parent 4a33691 commit 4dfff3d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions drivers/base/arch_topology.c
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 4dfff3d

Please sign in to comment.