From: "Michał Mirosław" <mirq-linux@rere.qmqm.pl> To: Wei Yongjun <weiyongjun1@huawei.com> Cc: Sebastian Reichel <sre@kernel.org>, Dan Carpenter <dan.carpenter@oracle.com>, linux-pm@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: Re: [PATCH -next] power: supply: bq25890_charger: fix missing unlock on error in bq25890_resume() Date: Wed, 06 May 2020 12:25:18 +0000 [thread overview] Message-ID: <20200506122516.GC18376@qmqm.qmqm.pl> (raw) In-Reply-To: <20200506014008.59755-1-weiyongjun1@huawei.com> On Wed, May 06, 2020 at 01:40:08AM +0000, Wei Yongjun wrote: > 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> A similar fix was sent by Dan Carpenter [1]. I'd prefer his version due to less lines introduced. [1] https://lore.kernel.org/linux-pm/20200506101116.GA77004@mwanda/ Best Regards, Micha³ Miros³aw > --- > 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 */ > > >
WARNING: multiple messages have this Message-ID (diff)
From: "Michał Mirosław" <mirq-linux@rere.qmqm.pl> To: Wei Yongjun <weiyongjun1@huawei.com> Cc: Sebastian Reichel <sre@kernel.org>, Dan Carpenter <dan.carpenter@oracle.com>, linux-pm@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: Re: [PATCH -next] power: supply: bq25890_charger: fix missing unlock on error in bq25890_resume() Date: Wed, 6 May 2020 14:25:18 +0200 [thread overview] Message-ID: <20200506122516.GC18376@qmqm.qmqm.pl> (raw) In-Reply-To: <20200506014008.59755-1-weiyongjun1@huawei.com> On Wed, May 06, 2020 at 01:40:08AM +0000, Wei Yongjun wrote: > 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> A similar fix was sent by Dan Carpenter [1]. I'd prefer his version due to less lines introduced. [1] https://lore.kernel.org/linux-pm/20200506101116.GA77004@mwanda/ Best Regards, Michał Mirosław > --- > 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 */ > > >
next prev parent reply other threads:[~2020-05-06 12:25 UTC|newest] Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-05-06 1:40 [PATCH -next] power: supply: bq25890_charger: fix missing unlock on error in bq25890_resume() Wei Yongjun 2020-05-06 1:40 ` Wei Yongjun 2020-05-06 12:25 ` Michał Mirosław [this message] 2020-05-06 12:25 ` Michał Mirosław
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20200506122516.GC18376@qmqm.qmqm.pl \ --to=mirq-linux@rere.qmqm.pl \ --cc=dan.carpenter@oracle.com \ --cc=kernel-janitors@vger.kernel.org \ --cc=linux-pm@vger.kernel.org \ --cc=sre@kernel.org \ --cc=weiyongjun1@huawei.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.