summaryrefslogtreecommitdiffstats
path: root/drivers/cpufreq
diff options
context:
space:
mode:
authorDave Jones <davej@redhat.com>2008-03-05 20:20:57 +0100
committerDave Jones <davej@redhat.com>2008-03-05 20:45:31 +0100
commit0db4a8a99f6a8534c526e8c9d4b13d098400d485 (patch)
tree47a83704487b43de3c4a0caa8eb9539491ee9221 /drivers/cpufreq
parentLinux 2.6.25-rc4 (diff)
downloadlinux-0db4a8a99f6a8534c526e8c9d4b13d098400d485.tar.xz
linux-0db4a8a99f6a8534c526e8c9d4b13d098400d485.zip
[CPUFREQ] Fix missing cpufreq_cpu_put() call in ->show
refactor to use gotos instead of explicit exit paths Signed-off-by: Dave Jones <davej@redhat.com>
Diffstat (limited to 'drivers/cpufreq')
-rw-r--r--drivers/cpufreq/cpufreq.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 89a29cd93783..6602e1d02de2 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -671,13 +671,13 @@ static ssize_t show(struct kobject * kobj, struct attribute * attr ,char * buf)
{
struct cpufreq_policy * policy = to_policy(kobj);
struct freq_attr * fattr = to_attr(attr);
- ssize_t ret;
+ ssize_t ret = -EINVAL;
policy = cpufreq_cpu_get(policy->cpu);
if (!policy)
- return -EINVAL;
+ goto no_policy;
if (lock_policy_rwsem_read(policy->cpu) < 0)
- return -EINVAL;
+ goto fail;
if (fattr->show)
ret = fattr->show(policy, buf);
@@ -685,8 +685,9 @@ static ssize_t show(struct kobject * kobj, struct attribute * attr ,char * buf)
ret = -EIO;
unlock_policy_rwsem_read(policy->cpu);
-
+fail:
cpufreq_cpu_put(policy);
+no_policy:
return ret;
}