Skip to content

Commit

Permalink
thermal: helpers: Rearrange thermal_cdev_set_cur_state()
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
rafaeljw committed Jan 12, 2024
1 parent 11fde93 commit fd881ea
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions drivers/thermal/thermal_helpers.c
Original file line number Diff line number Diff line change
Expand Up @@ -155,13 +155,14 @@ static int thermal_cdev_set_cur_state(struct thermal_cooling_device *cdev, int s
* registering function checked the ops are correctly set
*/
ret = cdev->ops->set_cur_state(cdev, state);
if (!ret) {
thermal_notify_cdev_state_update(cdev, state);
thermal_cooling_device_stats_update(cdev, state);
thermal_debug_cdev_state_update(cdev, state);
}
if (ret)
return ret;

return ret;
thermal_notify_cdev_state_update(cdev, state);
thermal_cooling_device_stats_update(cdev, state);
thermal_debug_cdev_state_update(cdev, state);

return 0;
}

void __thermal_cdev_update(struct thermal_cooling_device *cdev)
Expand Down

0 comments on commit fd881ea

Please sign in to comment.