aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/cpufreq/cpufreq.c
diff options
context:
space:
mode:
authorDave Jones <davej@redhat.com>2008-03-05 14:20:57 -0500
committerDave Jones <davej@redhat.com>2008-03-05 14:45:31 -0500
commit0db4a8a99f6a8534c526e8c9d4b13d098400d485 (patch)
tree47a83704487b43de3c4a0caa8eb9539491ee9221 /drivers/cpufreq/cpufreq.c
parent29e8c3c304b62f31b799565c9ee85d42bd163f80 (diff)
[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/cpufreq.c')
-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)
671{ 671{
672 struct cpufreq_policy * policy = to_policy(kobj); 672 struct cpufreq_policy * policy = to_policy(kobj);
673 struct freq_attr * fattr = to_attr(attr); 673 struct freq_attr * fattr = to_attr(attr);
674 ssize_t ret; 674 ssize_t ret = -EINVAL;
675 policy = cpufreq_cpu_get(policy->cpu); 675 policy = cpufreq_cpu_get(policy->cpu);
676 if (!policy) 676 if (!policy)
677 return -EINVAL; 677 goto no_policy;
678 678
679 if (lock_policy_rwsem_read(policy->cpu) < 0) 679 if (lock_policy_rwsem_read(policy->cpu) < 0)
680 return -EINVAL; 680 goto fail;
681 681
682 if (fattr->show) 682 if (fattr->show)
683 ret = fattr->show(policy, buf); 683 ret = fattr->show(policy, buf);
@@ -685,8 +685,9 @@ static ssize_t show(struct kobject * kobj, struct attribute * attr ,char * buf)
685 ret = -EIO; 685 ret = -EIO;
686 686
687 unlock_policy_rwsem_read(policy->cpu); 687 unlock_policy_rwsem_read(policy->cpu);
688 688fail:
689 cpufreq_cpu_put(policy); 689 cpufreq_cpu_put(policy);
690no_policy:
690 return ret; 691 return ret;
691} 692}
692 693