* [PATCH] [v2] power: supply: bq24190_charger: Fix runtime PM imbalance on error
@ 2020-05-25 11:05 Dinghao Liu
2020-05-25 11:09 ` Rafael J. Wysocki
0 siblings, 1 reply; 3+ messages in thread
From: Dinghao Liu @ 2020-05-25 11:05 UTC (permalink / raw)
To: dinghao.liu, kjlu; +Cc: Sebastian Reichel, linux-pm, linux-kernel
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>
---
Changelog:
v2: - Use pm_runtime_put_noidle() rather than
pm_runtime_put_autosuspend().
---
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..7b24c41a2137 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_noidle(bdi->dev);
return ret;
+ }
ret = bq24190_write_mask(bdi, info->reg, info->mask, info->shift, v);
if (ret)
--
2.17.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] [v2] power: supply: bq24190_charger: Fix runtime PM imbalance on error
2020-05-25 11:05 [PATCH] [v2] power: supply: bq24190_charger: Fix runtime PM imbalance on error Dinghao Liu
@ 2020-05-25 11:09 ` Rafael J. Wysocki
2020-06-19 17:03 ` Sebastian Reichel
0 siblings, 1 reply; 3+ messages in thread
From: Rafael J. Wysocki @ 2020-05-25 11:09 UTC (permalink / raw)
To: Dinghao Liu
Cc: Kangjie Lu, Sebastian Reichel, Linux PM, Linux Kernel Mailing List
On Mon, May 25, 2020 at 1:05 PM 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>
Better now:
Reviewed-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> ---
>
> Changelog:
>
> v2: - Use pm_runtime_put_noidle() rather than
> pm_runtime_put_autosuspend().
> ---
> 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..7b24c41a2137 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_noidle(bdi->dev);
> return ret;
> + }
>
> ret = bq24190_write_mask(bdi, info->reg, info->mask, info->shift, v);
> if (ret)
> --
> 2.17.1
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] [v2] power: supply: bq24190_charger: Fix runtime PM imbalance on error
2020-05-25 11:09 ` Rafael J. Wysocki
@ 2020-06-19 17:03 ` Sebastian Reichel
0 siblings, 0 replies; 3+ messages in thread
From: Sebastian Reichel @ 2020-06-19 17:03 UTC (permalink / raw)
To: Rafael J. Wysocki
Cc: Dinghao Liu, Kangjie Lu, Linux PM, Linux Kernel Mailing List
[-- Attachment #1: Type: text/plain, Size: 1495 bytes --]
Hi,
On Mon, May 25, 2020 at 01:09:00PM +0200, Rafael J. Wysocki wrote:
> On Mon, May 25, 2020 at 1:05 PM 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>
>
> Better now:
>
> Reviewed-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Thanks, queued.
-- Sebastian
> > ---
> >
> > Changelog:
> >
> > v2: - Use pm_runtime_put_noidle() rather than
> > pm_runtime_put_autosuspend().
> > ---
> > 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..7b24c41a2137 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_noidle(bdi->dev);
> > return ret;
> > + }
> >
> > ret = bq24190_write_mask(bdi, info->reg, info->mask, info->shift, v);
> > if (ret)
> > --
> > 2.17.1
> >
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-06-19 17:03 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-25 11:05 [PATCH] [v2] power: supply: bq24190_charger: Fix runtime PM imbalance on error Dinghao Liu
2020-05-25 11:09 ` Rafael J. Wysocki
2020-06-19 17:03 ` Sebastian Reichel
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).