asoc: lpass-cdc: return error when requesting incorrect state
Thermal framework is expected an error to be returned if the requested cur_state exceed the max_state. Change-Id: I1e0d8124a1aa6c0d755b35225207638aefdcb464 Signed-off-by: Junkai Cai <junkai@codeaurora.org>
This commit is contained in:

committed by
Gerrit - the friendly Code Review server

parent
fa58ae98f9
commit
63db490176
@@ -2846,19 +2846,23 @@ static int lpass_cdc_wsa_macro_set_cur_state(
|
||||
{
|
||||
struct lpass_cdc_wsa_macro_priv *wsa_priv = cdev->devdata;
|
||||
|
||||
if (!wsa_priv) {
|
||||
if (!wsa_priv || !wsa_priv->dev) {
|
||||
pr_err("%s: cdev->devdata is NULL\n", __func__);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (state < wsa_priv->thermal_max_state)
|
||||
if (state <= wsa_priv->thermal_max_state) {
|
||||
wsa_priv->thermal_cur_state = state;
|
||||
else
|
||||
wsa_priv->thermal_cur_state = wsa_priv->thermal_max_state;
|
||||
} else {
|
||||
dev_err(wsa_priv->dev,
|
||||
"%s: incorrect requested state:%d\n",
|
||||
__func__, state);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
dev_dbg(wsa_priv->dev,
|
||||
"%s: requested state:%d, actual state: %d\n",
|
||||
__func__, state, wsa_priv->thermal_cur_state);
|
||||
"%s: set the thermal current state to %d\n",
|
||||
__func__, wsa_priv->thermal_cur_state);
|
||||
|
||||
schedule_work(&wsa_priv->lpass_cdc_wsa_macro_cooling_work);
|
||||
|
||||
|
Reference in New Issue
Block a user