aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/cpufreq/cpufreq.c
diff options
context:
space:
mode:
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