Commit 0db4a8a9 authored by Dave Jones's avatar Dave Jones

[CPUFREQ] Fix missing cpufreq_cpu_put() call in ->show

refactor to use gotos instead of explicit exit paths
Signed-off-by: default avatarDave Jones <davej@redhat.com>
parent 29e8c3c3
......@@ -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;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment