* [PATCH] i2c: tegra: Fix PM device usage count
@ 2018-02-24 22:44 Tobias Jordan
2018-03-14 12:10 ` Thierry Reding
0 siblings, 1 reply; 2+ messages in thread
From: Tobias Jordan @ 2018-02-24 22:44 UTC (permalink / raw)
To: linux-i2c, linux-tegra, linux-kernel
Cc: Laxman Dewangan, Wolfram Sang, Thierry Reding, Jonathan Hunter
pm_runtime_get_sync() increases the device's usage count even when
reporting an error, so add a call to pm_runtime_put_noidle() in the
related error branches.
Fixes: 1f50ad2c86cd ("i2c: tegra: Add runtime power-management support")
Signed-off-by: Tobias Jordan <Tobias.Jordan@elektrobit.com>
---
This is one of a number of patches for problems found using coccinelle
scripting in the SIL2LinuxMP project. The patch has been compile-tested;
it's based on linux-next-20180223.
For a discussion of the corresponding issue, see
https://marc.info/?l=linux-pm&m=151904483924999&w=2
drivers/i2c/busses/i2c-tegra.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c
index 60292d243e24..d53136538339 100644
--- a/drivers/i2c/busses/i2c-tegra.c
+++ b/drivers/i2c/busses/i2c-tegra.c
@@ -484,6 +484,7 @@ static int tegra_i2c_init(struct tegra_i2c_dev *i2c_dev)
err = pm_runtime_get_sync(i2c_dev->dev);
if (err < 0) {
dev_err(i2c_dev->dev, "runtime resume failed %d\n", err);
+ pm_runtime_put_noidle(i2c_dev->dev);
return err;
}
@@ -740,6 +741,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;
}
--
2.11.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] i2c: tegra: Fix PM device usage count
2018-02-24 22:44 [PATCH] i2c: tegra: Fix PM device usage count Tobias Jordan
@ 2018-03-14 12:10 ` Thierry Reding
0 siblings, 0 replies; 2+ messages in thread
From: Thierry Reding @ 2018-03-14 12:10 UTC (permalink / raw)
To: Tobias Jordan
Cc: linux-i2c, linux-tegra, linux-kernel, Laxman Dewangan,
Wolfram Sang, Jonathan Hunter
[-- Attachment #1: Type: text/plain, Size: 931 bytes --]
On Sat, Feb 24, 2018 at 11:44:23PM +0100, Tobias Jordan wrote:
> pm_runtime_get_sync() increases the device's usage count even when
> reporting an error, so add a call to pm_runtime_put_noidle() in the
> related error branches.
>
> Fixes: 1f50ad2c86cd ("i2c: tegra: Add runtime power-management support")
> Signed-off-by: Tobias Jordan <Tobias.Jordan@elektrobit.com>
> ---
> This is one of a number of patches for problems found using coccinelle
> scripting in the SIL2LinuxMP project. The patch has been compile-tested;
> it's based on linux-next-20180223.
>
> For a discussion of the corresponding issue, see
> https://marc.info/?l=linux-pm&m=151904483924999&w=2
>
> drivers/i2c/busses/i2c-tegra.c | 2 ++
> 1 file changed, 2 insertions(+)
This seems okay to me, though given the discussion it might be
preferable to just ignore errors rather than fail.
Acked-by: Thierry Reding <treding@nvidia.com>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-03-14 12:10 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-24 22:44 [PATCH] i2c: tegra: Fix PM device usage count Tobias Jordan
2018-03-14 12:10 ` Thierry Reding
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.