diff options
author | Andi Shyti <andi.shyti@kernel.org> | 2024-08-12 21:40:29 +0200 |
---|---|---|
committer | Andi Shyti <andi.shyti@kernel.org> | 2024-09-10 00:33:55 +0200 |
commit | 23cc961a08591976eb17ca8552a602425b1a780d (patch) | |
tree | 016e59b61918ba1baba66a489ab0b076b047fc40 | |
parent | 2d30c638f98408c0d2ad5a8c3b2421328aa30213 (diff) | |
download | linux-23cc961a08591976eb17ca8552a602425b1a780d.tar.gz linux-23cc961a08591976eb17ca8552a602425b1a780d.tar.bz2 linux-23cc961a08591976eb17ca8552a602425b1a780d.zip |
i2c: qcom-geni: Use goto for clearer exit path
Refactor the code by using goto statements to reduce duplication
and make the exit path clearer.
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
-rw-r--r-- | drivers/i2c/busses/i2c-qcom-geni.c | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/drivers/i2c/busses/i2c-qcom-geni.c b/drivers/i2c/busses/i2c-qcom-geni.c index 2ca785410547..eebb0cbb6ca4 100644 --- a/drivers/i2c/busses/i2c-qcom-geni.c +++ b/drivers/i2c/busses/i2c-qcom-geni.c @@ -986,21 +986,24 @@ static int __maybe_unused geni_i2c_runtime_resume(struct device *dev) return ret; ret = clk_prepare_enable(gi2c->core_clk); - if (ret) { - geni_icc_disable(&gi2c->se); - return ret; - } + if (ret) + goto out_icc_disable; ret = geni_se_resources_on(&gi2c->se); - if (ret) { - clk_disable_unprepare(gi2c->core_clk); - geni_icc_disable(&gi2c->se); - return ret; - } + if (ret) + goto out_clk_disable; enable_irq(gi2c->irq); gi2c->suspended = 0; + return 0; + +out_clk_disable: + clk_disable_unprepare(gi2c->core_clk); +out_icc_disable: + geni_icc_disable(&gi2c->se); + + return ret; } static int __maybe_unused geni_i2c_suspend_noirq(struct device *dev) |