Message ID | 20200506014008.59755-1-weiyongjun1@huawei.com |
---|---|
State | New |
Headers | show |
Series | [-next] power: supply: bq25890_charger: fix missing unlock on error in bq25890_resume() | expand |
diff --git a/drivers/power/supply/bq25890_charger.c b/drivers/power/supply/bq25890_charger.c index 9339e216651f..cd9c5ed9bc0c 100644 --- a/drivers/power/supply/bq25890_charger.c +++ b/drivers/power/supply/bq25890_charger.c @@ -977,14 +977,18 @@ static int bq25890_resume(struct device *dev) mutex_lock(&bq->lock); ret = bq25890_get_chip_state(bq, &bq->state); - if (ret < 0) + if (ret < 0) { + mutex_unlock(&bq->lock); return ret; + } /* Re-enable ADC only if charger is plugged in. */ if (bq->state.online) { ret = bq25890_field_write(bq, F_CONV_START, 1); - if (ret < 0) + if (ret < 0) { + mutex_unlock(&bq->lock); return ret; + } } /* signal userspace, maybe state changed while suspended */
Add the missing unlock before return from function bq25890_resume() in the error handling case. Fixes: 72d9cd9cdc18 ("power: bq25890: protect view of the chip's state") Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com> --- drivers/power/supply/bq25890_charger.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)