cpufreq: propagate error returned by kobject_move()
authorViresh Kumar <viresh.kumar@linaro.org>
Thu, 17 Jul 2014 05:18:27 +0000 (10:48 +0530)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Mon, 21 Jul 2014 11:43:20 +0000 (13:43 +0200)
We are returning -EINVAL instead of the error returned from kobject_move() when
it fails. Propagate the actual error number.

Also add a meaningful print when sysfs_create_link() fails.

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 e572d51db945025611666b93adc64a202d251d23..ec25ca6076790a92811fd490ada080818aa3ed8d 100644 (file)
@@ -1322,10 +1322,12 @@ static int cpufreq_nominate_new_policy_cpu(struct cpufreq_policy *policy,
        ret = kobject_move(&policy->kobj, &cpu_dev->kobj);
        if (ret) {
                pr_err("%s: Failed to move kobj: %d\n", __func__, ret);
-               ret = sysfs_create_link(&cpu_dev->kobj, &policy->kobj,
-                                       "cpufreq");
 
-               return -EINVAL;
+               if (sysfs_create_link(&cpu_dev->kobj, &policy->kobj, "cpufreq"))
+                       pr_err("%s: Failed to restore kobj link to cpu:%d\n",
+                              __func__, cpu_dev->id);
+
+               return ret;
        }
 
        return cpu_dev->id;