2020-09-08 22:43:44

by Dmitry Osipenko

[permalink] [raw]
Subject: [PATCH v7 02/34] i2c: tegra: Add missing pm_runtime_put()

The pm_runtime_get_sync() always bumps refcount regardless of whether it
succeeds or fails. Hence driver is responsible for restoring of the RPM
refcounting. This patch adds missing RPM puts which restore refcounting
in a case of pm_runtime_get_sync() error.

Suggested-by: Andy Shevchenko <[email protected]>
Signed-off-by: Dmitry Osipenko <[email protected]>
---
drivers/i2c/busses/i2c-tegra.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c
index ab88cdd70376..4e7d0eec0dd3 100644
--- a/drivers/i2c/busses/i2c-tegra.c
+++ b/drivers/i2c/busses/i2c-tegra.c
@@ -1375,6 +1375,7 @@ static int tegra_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[],
ret = pm_runtime_get_sync(i2c_dev->dev);
if (ret < 0) {
dev_err(i2c_dev->dev, "runtime resume failed %d\n", ret);
+ pm_runtime_put_noidle(i2c_dev->dev);
return ret;
}

@@ -1786,7 +1787,7 @@ static int tegra_i2c_probe(struct platform_device *pdev)
ret = pm_runtime_get_sync(i2c_dev->dev);
if (ret < 0) {
dev_err(&pdev->dev, "runtime resume failed\n");
- goto disable_rpm;
+ goto put_rpm;
}
}

@@ -1851,7 +1852,6 @@ static int tegra_i2c_probe(struct platform_device *pdev)
else
tegra_i2c_runtime_suspend(&pdev->dev);

-disable_rpm:
if (pm_runtime_enabled(&pdev->dev))
pm_runtime_disable(&pdev->dev);

--
2.27.0


2020-09-17 11:26:11

by Thierry Reding

[permalink] [raw]
Subject: Re: [PATCH v7 02/34] i2c: tegra: Add missing pm_runtime_put()

On Wed, Sep 09, 2020 at 01:39:34AM +0300, Dmitry Osipenko wrote:
> The pm_runtime_get_sync() always bumps refcount regardless of whether it
> succeeds or fails. Hence driver is responsible for restoring of the RPM
> refcounting. This patch adds missing RPM puts which restore refcounting
> in a case of pm_runtime_get_sync() error.
>
> Suggested-by: Andy Shevchenko <[email protected]>
> Signed-off-by: Dmitry Osipenko <[email protected]>
> ---
> drivers/i2c/busses/i2c-tegra.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)

Reviewed-by: Thierry Reding <[email protected]>


Attachments:
(No filename) (610.00 B)
signature.asc (849.00 B)
Download all attachments

2020-09-21 10:20:04

by Thierry Reding

[permalink] [raw]
Subject: Re: [PATCH v7 02/34] i2c: tegra: Add missing pm_runtime_put()

On Wed, 09 Sep 2020 01:39:34 +0300, Dmitry Osipenko wrote:
> The pm_runtime_get_sync() always bumps refcount regardless of whether it
> succeeds or fails. Hence driver is responsible for restoring of the RPM
> refcounting. This patch adds missing RPM puts which restore refcounting
> in a case of pm_runtime_get_sync() error.
>
> Suggested-by: Andy Shevchenko <[email protected]>
> Signed-off-by: Dmitry Osipenko <[email protected]>
> Reviewed-by: Thierry Reding <[email protected]>
> ---
> drivers/i2c/busses/i2c-tegra.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)

Tested-by: Thierry Reding <[email protected]>