Skip to content

Commit fd881ea

Browse files
committed
thermal: helpers: Rearrange thermal_cdev_set_cur_state()
Change the code layout in thermal_cdev_set_cur_state() so it returns early on errors which is more consistent with what happens elsewhere. No intentional functional impact. Signed-off-by: Rafael J. Wysocki <[email protected]> Reviewed-by: Daniel Lezcano <[email protected]>
1 parent 11fde93 commit fd881ea

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

drivers/thermal/thermal_helpers.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -155,13 +155,14 @@ static int thermal_cdev_set_cur_state(struct thermal_cooling_device *cdev, int s
155155
* registering function checked the ops are correctly set
156156
*/
157157
ret = cdev->ops->set_cur_state(cdev, state);
158-
if (!ret) {
159-
thermal_notify_cdev_state_update(cdev, state);
160-
thermal_cooling_device_stats_update(cdev, state);
161-
thermal_debug_cdev_state_update(cdev, state);
162-
}
158+
if (ret)
159+
return ret;
163160

164-
return ret;
161+
thermal_notify_cdev_state_update(cdev, state);
162+
thermal_cooling_device_stats_update(cdev, state);
163+
thermal_debug_cdev_state_update(cdev, state);
164+
165+
return 0;
165166
}
166167

167168
void __thermal_cdev_update(struct thermal_cooling_device *cdev)

0 commit comments

Comments
 (0)