Skip to content

Commit

Permalink
cpufreq/pasemi: fix possible object reference leak
Browse files Browse the repository at this point in the history
The call to of_get_cpu_node returns a node pointer with refcount
incremented thus it must be explicitly decremented after the last
usage.

Detected by coccinelle with the following warnings:
./drivers/cpufreq/pasemi-cpufreq.c:212:1-7: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 147, but without a corresponding object release within this function.
./drivers/cpufreq/pasemi-cpufreq.c:220:1-7: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 147, but without a corresponding object release within this function.

Signed-off-by: Wen Yang <[email protected]>
Cc: "Rafael J. Wysocki" <[email protected]>
Cc: Viresh Kumar <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Signed-off-by: Viresh Kumar <[email protected]>
  • Loading branch information
taskset authored and vireshk committed Apr 8, 2019
1 parent ddb07fb commit a9acc26
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions drivers/cpufreq/pasemi-cpufreq.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ static int pas_cpufreq_cpu_init(struct cpufreq_policy *policy)

cpu = of_get_cpu_node(policy->cpu, NULL);

of_node_put(cpu);
if (!cpu)
goto out;

Expand Down

0 comments on commit a9acc26

Please sign in to comment.