]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
cpuidle: rearrange __cpuidle_register_device() to keep minimal exit points
authorViresh Kumar <viresh.kumar@linaro.org>
Thu, 3 Oct 2013 15:56:46 +0000 (21:26 +0530)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Wed, 30 Oct 2013 00:21:22 +0000 (01:21 +0100)
This patch rearranges __cpuidle_register_device() a bit in order to
reduce the number of exit points in that function.

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

index 211e504263fa718fbd84c3af2dd7f46f24a233b2..8c91badff00bd31e32473ed12d137da8f33eb33c 100644 (file)
@@ -383,13 +383,12 @@ static int __cpuidle_register_device(struct cpuidle_device *dev)
        list_add(&dev->device_list, &cpuidle_detected_devices);
 
        ret = cpuidle_coupled_register_device(dev);
-       if (ret) {
+       if (ret)
                __cpuidle_unregister_device(dev);
-               return ret;
-       }
+       else
+               dev->registered = 1;
 
-       dev->registered = 1;
-       return 0;
+       return ret;
 }
 
 /**