Commit cf5701bf authored by Dan Carpenter's avatar Dan Carpenter Committed by Sebastian Reichel

power: bq25890: unlock on error paths in bq25890_resume()

We introduced some new locking here, but need to update the error
paths so they unlock before returning.

Fixes: 72d9cd9c ("power: bq25890: protect view of the chip's state")
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: default avatarMichał Mirosław <mirq-linux@rere.qmqm.pl>
Signed-off-by: default avatarSebastian Reichel <sebastian.reichel@collabora.com>
parent 2ad3d74e
...@@ -978,21 +978,22 @@ static int bq25890_resume(struct device *dev) ...@@ -978,21 +978,22 @@ static int bq25890_resume(struct device *dev)
ret = bq25890_get_chip_state(bq, &bq->state); ret = bq25890_get_chip_state(bq, &bq->state);
if (ret < 0) if (ret < 0)
return ret; goto unlock;
/* Re-enable ADC only if charger is plugged in. */ /* Re-enable ADC only if charger is plugged in. */
if (bq->state.online) { if (bq->state.online) {
ret = bq25890_field_write(bq, F_CONV_START, 1); ret = bq25890_field_write(bq, F_CONV_START, 1);
if (ret < 0) if (ret < 0)
return ret; goto unlock;
} }
/* signal userspace, maybe state changed while suspended */ /* signal userspace, maybe state changed while suspended */
power_supply_changed(bq->charger); power_supply_changed(bq->charger);
unlock:
mutex_unlock(&bq->lock); mutex_unlock(&bq->lock);
return 0; return ret;
} }
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment