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.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 89a29cd93783..35a26a3e5f68 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
@@ -695,13 +696,13 @@ static ssize_t store(struct kobject * kobj, struct attribute * attr,
695{ 696{
696 struct cpufreq_policy * policy = to_policy(kobj); 697 struct cpufreq_policy * policy = to_policy(kobj);
697 struct freq_attr * fattr = to_attr(attr); 698 struct freq_attr * fattr = to_attr(attr);
698 ssize_t ret; 699 ssize_t ret = -EINVAL;
699 policy = cpufreq_cpu_get(policy->cpu); 700 policy = cpufreq_cpu_get(policy->cpu);
700 if (!policy) 701 if (!policy)
701 return -EINVAL; 702 goto no_policy;
702 703
703 if (lock_policy_rwsem_write(policy->cpu) < 0) 704 if (lock_policy_rwsem_write(policy->cpu) < 0)
704 return -EINVAL; 705 goto fail;
705 706
706 if (fattr->store) 707 if (fattr->store)
707 ret = fattr->store(policy, buf, count); 708 ret = fattr->store(policy, buf, count);
@@ -709,8 +710,9 @@ static ssize_t store(struct kobject * kobj, struct attribute * attr,
709 ret = -EIO; 710 ret = -EIO;
710 711
711 unlock_policy_rwsem_write(policy->cpu); 712 unlock_policy_rwsem_write(policy->cpu);
712 713fail:
713 cpufreq_cpu_put(policy); 714 cpufreq_cpu_put(policy);
715no_policy:
714 return ret; 716 return ret;
715} 717}
716 718
@@ -1775,7 +1777,7 @@ static int __cpuinit cpufreq_cpu_callback(struct notifier_block *nfb,
1775 return NOTIFY_OK; 1777 return NOTIFY_OK;
1776} 1778}
1777 1779
1778static struct notifier_block __cpuinitdata cpufreq_cpu_notifier = 1780static struct notifier_block __refdata cpufreq_cpu_notifier =
1779{ 1781{
1780 .notifier_call = cpufreq_cpu_callback, 1782 .notifier_call = cpufreq_cpu_callback,
1781}; 1783};