From: "Rafael J. Wysocki" <rafael@kernel.org>
To: Dinghao Liu <dinghao.liu@zju.edu.cn>
Cc: Kangjie Lu <kjlu@umn.edu>, Sebastian Reichel <sre@kernel.org>,
Linux PM <linux-pm@vger.kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] power: supply: bq24190_charger: fix runtime pm imbalance
Date: Mon, 25 May 2020 12:33:49 +0200 [thread overview]
Message-ID: <CAJZ5v0j5XB_me9YSUemUaz6URair4CtRVSU1U6F62FWCi2SRJg@mail.gmail.com> (raw)
In-Reply-To: <20200520074309.19366-1-dinghao.liu@zju.edu.cn>
On Wed, May 20, 2020 at 10:01 AM Dinghao Liu <dinghao.liu@zju.edu.cn> wrote:
>
> pm_runtime_get_sync() increments the runtime PM usage counter even
> it returns an error code. Thus a pairing decrement is needed on
> the error handling path to keep the counter balanced.
>
> Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
> ---
> drivers/power/supply/bq24190_charger.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/power/supply/bq24190_charger.c b/drivers/power/supply/bq24190_charger.c
> index 453d6332d43a..4f7c6b6abb56 100644
> --- a/drivers/power/supply/bq24190_charger.c
> +++ b/drivers/power/supply/bq24190_charger.c
> @@ -481,8 +481,10 @@ static ssize_t bq24190_sysfs_store(struct device *dev,
> return ret;
>
> ret = pm_runtime_get_sync(bdi->dev);
> - if (ret < 0)
> + if (ret < 0) {
> + pm_runtime_put_autosuspend(bdi->dev);
The autosuspend thing is not necessary here, because the suspend is
not going to work anyway due to the resume error, so this can be
_put_noidle().
You might as well do something like
count = ret;
goto out;
here and add an "out" label before the pm_runtime_mark_last_busy() call, though.
> return ret;
> + }
>
> ret = bq24190_write_mask(bdi, info->reg, info->mask, info->shift, v);
> if (ret)
> --
> 2.17.1
>
next prev parent reply other threads:[~2020-05-25 10:34 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-20 7:43 [PATCH] power: supply: bq24190_charger: fix runtime pm imbalance Dinghao Liu
2020-05-25 10:33 ` Rafael J. Wysocki [this message]
2020-05-25 10:39 ` dinghao.liu
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=CAJZ5v0j5XB_me9YSUemUaz6URair4CtRVSU1U6F62FWCi2SRJg@mail.gmail.com \
--to=rafael@kernel.org \
--cc=dinghao.liu@zju.edu.cn \
--cc=kjlu@umn.edu \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=sre@kernel.org \
/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: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).