]> asedeno.scripts.mit.edu Git - linux.git/commit
cpufreq: kirkwood: fix possible object reference leak
authorWen Yang <wen.yang99@zte.com.cn>
Mon, 1 Apr 2019 01:37:50 +0000 (09:37 +0800)
committerViresh Kumar <viresh.kumar@linaro.org>
Mon, 8 Apr 2019 10:05:24 +0000 (15:35 +0530)
commit7c468966f05ac9c17bb5948275283d34e6fe0660
treed3420eca7d2871bcfc236fb422556024821faf9c
parentddb64c5db3cc8fb9c1242214d5798b2c2865681c
cpufreq: kirkwood: fix possible object reference leak

The call to of_get_child_by_name 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/kirkwood-cpufreq.c:127:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 118, but without a corresponding object release within this function.
./drivers/cpufreq/kirkwood-cpufreq.c:133:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 118, but without a corresponding object release within this function.

and also do some cleanup:
- of_node_put(np);
- np = NULL;
...
of_node_put(np);

Signed-off-by: Wen Yang <wen.yang99@zte.com.cn>
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
Cc: Viresh Kumar <viresh.kumar@linaro.org>
Cc: linux-pm@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
drivers/cpufreq/kirkwood-cpufreq.c