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
@@ -2844,19 +2844,23 @@ static int lpass_cdc_wsa2_macro_set_cur_state(
|
||||
{
|
||||
struct lpass_cdc_wsa2_macro_priv *wsa2_priv = cdev->devdata;
|
||||
|
||||
if (!wsa2_priv) {
|
||||
if (!wsa2_priv || !wsa2_priv->dev) {
|
||||
pr_err("%s: cdev->devdata is NULL\n", __func__);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (state < wsa2_priv->thermal_max_state)
|
||||
if (state <= wsa2_priv->thermal_max_state) {
|
||||
wsa2_priv->thermal_cur_state = state;
|
||||
else
|
||||
wsa2_priv->thermal_cur_state = wsa2_priv->thermal_max_state;
|
||||
} else {
|
||||
dev_err(wsa2_priv->dev,
|
||||
"%s: incorrect requested state:%d\n",
|
||||
__func__, state);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
dev_dbg(wsa2_priv->dev,
|
||||
"%s: requested state:%d, actual state: %d\n",
|
||||
__func__, state, wsa2_priv->thermal_cur_state);
|
||||
"%s: set the thermal current state to %d\n",
|
||||
__func__, wsa2_priv->thermal_cur_state);
|
||||
|
||||
schedule_work(&wsa2_priv->lpass_cdc_wsa2_macro_cooling_work);
|
||||
|
||||
|
Reference in New Issue
Block a user