Skip to content

Commit

Permalink
[CPUFREQ] Fix missing cpufreq_cpu_put() call in ->show
Browse files Browse the repository at this point in the history
refactor to use gotos instead of explicit exit paths

Signed-off-by: Dave Jones <davej@redhat.com>
  • Loading branch information
Dave Jones committed Mar 5, 2008
1 parent 29e8c3c commit 0db4a8a
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions drivers/cpufreq/cpufreq.c
Original file line number Diff line number Diff line change
Expand Up @@ -671,22 +671,23 @@ 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);
else
ret = -EIO;

unlock_policy_rwsem_read(policy->cpu);

fail:
cpufreq_cpu_put(policy);
no_policy:
return ret;
}

Expand Down

0 comments on commit 0db4a8a

Please sign in to comment.