summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorGaurav Jindal <gauravjindal1104@gmail.com>2017-09-01 22:26:38 +0300
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2017-11-09 01:15:30 +0300
commit3fc74bd8a723c91a5b4627079c511fcaf3c75017 (patch)
tree40a72ec4155953cb36261df89baae05c4487abcb /drivers
parente7b06a09e7d87ec0d6d8b17eec50fbb93667eee1 (diff)
downloadlinux-3fc74bd8a723c91a5b4627079c511fcaf3c75017.tar.xz
cpuidle: Avoid assignment in if () argument
Clean up cpuidle_enable_device() to avoid doing an assignment in an expression evaluated as an argument of if (), which also makes the code in question more readable. Signed-off-by: Gaurav Jindal <gauravjindal1104@gmail.com> [ rjw: Subject & changelog ] Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/cpuidle/cpuidle.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c
index 27f9648b61c2..68a16827f45f 100644
--- a/drivers/cpuidle/cpuidle.c
+++ b/drivers/cpuidle/cpuidle.c
@@ -403,9 +403,11 @@ int cpuidle_enable_device(struct cpuidle_device *dev)
if (ret)
return ret;
- if (cpuidle_curr_governor->enable &&
- (ret = cpuidle_curr_governor->enable(drv, dev)))
- goto fail_sysfs;
+ if (cpuidle_curr_governor->enable) {
+ ret = cpuidle_curr_governor->enable(drv, dev);
+ if (ret)
+ goto fail_sysfs;
+ }
smp_wmb();