summaryrefslogtreecommitdiffstats
path: root/drivers/cpufreq/cpufreq.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/cpufreq/cpufreq.c')
-rw-r--r--drivers/cpufreq/cpufreq.c28
1 files changed, 7 insertions, 21 deletions
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 576b312645a5..c8b2ca0f44ae 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -818,14 +818,11 @@ static int cpufreq_add_dev_symlink(struct cpufreq_policy *policy)
continue;
pr_debug("Adding link for CPU: %u\n", j);
- cpufreq_cpu_get(policy->cpu);
cpu_dev = get_cpu_device(j);
ret = sysfs_create_link(&cpu_dev->kobj, &policy->kobj,
"cpufreq");
- if (ret) {
- cpufreq_cpu_put(policy);
- return ret;
- }
+ if (ret)
+ break;
}
return ret;
}
@@ -908,7 +905,8 @@ static int cpufreq_add_policy_cpu(unsigned int cpu, unsigned int sibling,
unsigned long flags;
policy = cpufreq_cpu_get(sibling);
- WARN_ON(!policy);
+ if (WARN_ON_ONCE(!policy))
+ return -ENODATA;
if (has_target)
__cpufreq_governor(policy, CPUFREQ_GOV_STOP);
@@ -930,16 +928,10 @@ static int cpufreq_add_policy_cpu(unsigned int cpu, unsigned int sibling,
}
/* Don't touch sysfs links during light-weight init */
- if (frozen) {
- /* Drop the extra refcount that we took above */
- cpufreq_cpu_put(policy);
- return 0;
- }
-
- ret = sysfs_create_link(&dev->kobj, &policy->kobj, "cpufreq");
- if (ret)
- cpufreq_cpu_put(policy);
+ if (!frozen)
+ ret = sysfs_create_link(&dev->kobj, &policy->kobj, "cpufreq");
+ cpufreq_cpu_put(policy);
return ret;
}
#endif
@@ -1298,12 +1290,6 @@ static int __cpufreq_remove_dev(struct device *dev,
if (!frozen)
cpufreq_policy_free(data);
} else {
-
- if (!frozen) {
- pr_debug("%s: removing link, cpu: %d\n", __func__, cpu);
- cpufreq_cpu_put(data);
- }
-
if (cpufreq_driver->target) {
__cpufreq_governor(data, CPUFREQ_GOV_START);
__cpufreq_governor(data, CPUFREQ_GOV_LIMITS);
OpenPOWER on IntegriCloud