cpufreq: Remove extra variables from cpufreq_add_dev_symlink()
authorViresh Kumar <viresh.kumar@linaro.org>
Wed, 31 Jul 2013 12:31:33 +0000 (14:31 +0200)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Wed, 7 Aug 2013 21:02:49 +0000 (23:02 +0200)
We call cpufreq_cpu_get() in cpufreq_add_dev_symlink() to increase usage
refcount of policy, but not to get a policy for the given CPU.  So, we
don't really need to capture the return value of this routine.  We can
simply use policy passed as an argument to cpufreq_add_dev_symlink().

Moreover debug print is rewritten to make it more clear.

[rjw: Changelog]
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/cpufreq/cpufreq.c

index 370abb6..b6154ca 100644 (file)
@@ -813,19 +813,18 @@ static int cpufreq_add_dev_symlink(unsigned int cpu,
        int ret = 0;
 
        for_each_cpu(j, policy->cpus) {
-               struct cpufreq_policy *managed_policy;
                struct device *cpu_dev;
 
                if (j == cpu)
                        continue;
 
-               pr_debug("CPU %u already managed, adding link\n", j);
-               managed_policy = cpufreq_cpu_get(cpu);
+               pr_debug("Adding link for CPU: %u\n", j);
+               cpufreq_cpu_get(cpu);
                cpu_dev = get_cpu_device(j);
                ret = sysfs_create_link(&cpu_dev->kobj, &policy->kobj,
                                        "cpufreq");
                if (ret) {
-                       cpufreq_cpu_put(managed_policy);
+                       cpufreq_cpu_put(policy);
                        return ret;
                }
        }