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 <andy.shevchenko@gmail.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Reviewed-by: Thierry Reding <treding@nvidia.com> Tested-by: Thierry Reding <treding@nvidia.com> Signed-off-by: Dmitry Osipenko <digetx@gmail.com> Signed-off-by: Wolfram Sang <wsa@kernel.org>
This commit is contained in:
parent
900aed24d3
commit
e4fc2efbc3
@ -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);
|
ret = pm_runtime_get_sync(i2c_dev->dev);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
dev_err(i2c_dev->dev, "runtime resume failed %d\n", ret);
|
dev_err(i2c_dev->dev, "runtime resume failed %d\n", ret);
|
||||||
|
pm_runtime_put_noidle(i2c_dev->dev);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1786,7 +1787,7 @@ static int tegra_i2c_probe(struct platform_device *pdev)
|
|||||||
ret = pm_runtime_get_sync(i2c_dev->dev);
|
ret = pm_runtime_get_sync(i2c_dev->dev);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
dev_err(&pdev->dev, "runtime resume failed\n");
|
dev_err(&pdev->dev, "runtime resume failed\n");
|
||||||
goto disable_rpm;
|
goto put_rpm;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1851,7 +1852,6 @@ put_rpm:
|
|||||||
else
|
else
|
||||||
tegra_i2c_runtime_suspend(&pdev->dev);
|
tegra_i2c_runtime_suspend(&pdev->dev);
|
||||||
|
|
||||||
disable_rpm:
|
|
||||||
if (pm_runtime_enabled(&pdev->dev))
|
if (pm_runtime_enabled(&pdev->dev))
|
||||||
pm_runtime_disable(&pdev->dev);
|
pm_runtime_disable(&pdev->dev);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user