mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-14 16:46:15 -04:00
icnss2: Add check for max thermal state
Add check for maximum thermal state while setting current state. Change-Id: I4ade853d0cda1d8754486dc6dd8f53596fae7a9a Signed-off-by: Naman Padhiar <npadhiar@codeaurora.org>
This commit is contained in:
parent
879de41f37
commit
d915a46562
1 changed files with 8 additions and 2 deletions
|
|
@ -2257,17 +2257,23 @@ static int icnss_tcdev_set_cur_state(struct thermal_cooling_device *tcdev,
|
|||
if (!penv->ops || !penv->ops->set_therm_cdev_state)
|
||||
return 0;
|
||||
|
||||
if (thermal_state > icnss_tcdev->max_thermal_state)
|
||||
return -EINVAL;
|
||||
|
||||
icnss_pr_vdbg("Cooling device set current state: %ld,for cdev id %d",
|
||||
thermal_state, icnss_tcdev->tcdev_id);
|
||||
|
||||
mutex_lock(&penv->tcdev_lock);
|
||||
icnss_tcdev->curr_thermal_state = thermal_state;
|
||||
ret = penv->ops->set_therm_cdev_state(dev, thermal_state,
|
||||
icnss_tcdev->tcdev_id);
|
||||
if (!ret)
|
||||
icnss_tcdev->curr_thermal_state = thermal_state;
|
||||
mutex_unlock(&penv->tcdev_lock);
|
||||
if (ret)
|
||||
if (ret) {
|
||||
icnss_pr_err("Setting Current Thermal State Failed: %d,for cdev id %d",
|
||||
ret, icnss_tcdev->tcdev_id);
|
||||
return ret;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue