From patchwork Wed May 6 01:40:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yongjun X-Patchwork-Id: 212124 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.7 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D9054C47247 for ; Wed, 6 May 2020 01:36:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BFC1C20757 for ; Wed, 6 May 2020 01:36:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729802AbgEFBgQ (ORCPT ); Tue, 5 May 2020 21:36:16 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:44100 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729647AbgEFBgP (ORCPT ); Tue, 5 May 2020 21:36:15 -0400 Received: from DGGEMS401-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 46E85C72239DDB71EF6C; Wed, 6 May 2020 09:36:11 +0800 (CST) Received: from localhost.localdomain.localdomain (10.175.113.25) by DGGEMS401-HUB.china.huawei.com (10.3.19.201) with Microsoft SMTP Server id 14.3.487.0; Wed, 6 May 2020 09:36:00 +0800 From: Wei Yongjun To: Sebastian Reichel , Micha Mirosaw CC: Wei Yongjun , , Subject: [PATCH -next] power: supply: bq25890_charger: fix missing unlock on error in bq25890_resume() Date: Wed, 6 May 2020 01:40:08 +0000 Message-ID: <20200506014008.59755-1-weiyongjun1@huawei.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-Originating-IP: [10.175.113.25] X-CFilter-Loop: Reflected Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org 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 --- drivers/power/supply/bq25890_charger.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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 */