2020-07-27 20:54:14

by Sowjanya Komatineni

[permalink] [raw]
Subject: [RFC PATCH v5 03/14] i2c: tegra: Fix the error path in tegra_i2c_runtime_resume

tegra_i2c_runtime_resume does not disable prior enabled clocks
properly.

This patch fixes it.

Reviewed-by: Dmitry Osipenko <[email protected]>
Signed-off-by: Sowjanya Komatineni <[email protected]>
---
drivers/i2c/busses/i2c-tegra.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c
index c91307b9..7b93c45 100644
--- a/drivers/i2c/busses/i2c-tegra.c
+++ b/drivers/i2c/busses/i2c-tegra.c
@@ -665,18 +665,23 @@ static int __maybe_unused tegra_i2c_runtime_resume(struct device *dev)
ret = clk_enable(i2c_dev->slow_clk);
if (ret < 0) {
dev_err(dev, "failed to enable slow clock: %d\n", ret);
- return ret;
+ goto disable_fast_clk;
}

ret = clk_enable(i2c_dev->div_clk);
if (ret < 0) {
dev_err(i2c_dev->dev,
"Enabling div clk failed, err %d\n", ret);
- clk_disable(i2c_dev->fast_clk);
- return ret;
+ goto disable_slow_clk;
}

return 0;
+
+disable_slow_clk:
+ clk_disable(i2c_dev->slow_clk);
+disable_fast_clk:
+ clk_disable(i2c_dev->fast_clk);
+ return ret;
}

static int __maybe_unused tegra_i2c_runtime_suspend(struct device *dev)
--
2.7.4


2020-07-28 16:35:04

by Wolfram Sang

[permalink] [raw]
Subject: Re: [RFC PATCH v5 03/14] i2c: tegra: Fix the error path in tegra_i2c_runtime_resume

On Mon, Jul 27, 2020 at 01:57:21PM -0700, Sowjanya Komatineni wrote:
> tegra_i2c_runtime_resume does not disable prior enabled clocks
> properly.
>
> This patch fixes it.
>
> Reviewed-by: Dmitry Osipenko <[email protected]>
> Signed-off-by: Sowjanya Komatineni <[email protected]>

Applied to for-next, thanks!


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