Skip to content

Commit

Permalink
i2c: tegra: Fix the error path in tegra_i2c_runtime_resume
Browse files Browse the repository at this point in the history
tegra_i2c_runtime_resume does not disable prior enabled clocks
properly.

This patch fixes it.

Reviewed-by: Dmitry Osipenko <digetx@gmail.com>
Signed-off-by: Sowjanya Komatineni <skomatineni@nvidia.com>
Signed-off-by: Wolfram Sang <wsa@kernel.org>
  • Loading branch information
Sowjanya Komatineni authored and Wolfram Sang committed Jul 28, 2020
1 parent 7232f53 commit 42aa38b
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions drivers/i2c/busses/i2c-tegra.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 42aa38b

Please sign in to comment.