summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYang Yingliang <yangyingliang@huawei.com>2023-11-30 09:43:24 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-01-01 12:42:34 +0000
commit5fcd03fa028ba2d77717de41197fd5baa5bc7c5c (patch)
tree7ecd7345e471382f310a463c99577fb23ade0ef2
parentfb0f25c8fe6d8ae45bfb24f869ea8c41d35e979a (diff)
downloadlinux-stable-5fcd03fa028ba2d77717de41197fd5baa5bc7c5c.tar.gz
linux-stable-5fcd03fa028ba2d77717de41197fd5baa5bc7c5c.tar.bz2
linux-stable-5fcd03fa028ba2d77717de41197fd5baa5bc7c5c.zip
i2c: qcom-geni: fix missing clk_disable_unprepare() and geni_se_resources_off()
[ Upstream commit 043465b66506e8c647cdd38a2db1f2ee0f369a1b ] Add missing clk_disable_unprepare() and geni_se_resources_off() in the error path in geni_i2c_probe(). Fixes: 14d02fbadb5d ("i2c: qcom-geni: add desc struct to prepare support for I2C Master Hub variant") Signed-off-by: Yang Yingliang <yangyingliang@huawei.com> Reviewed-by: Andi Shyti <andi.shyti@kernel.org> Signed-off-by: Wolfram Sang <wsa@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r--drivers/i2c/busses/i2c-qcom-geni.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/i2c/busses/i2c-qcom-geni.c b/drivers/i2c/busses/i2c-qcom-geni.c
index 229353e96e09..0a9d389df301 100644
--- a/drivers/i2c/busses/i2c-qcom-geni.c
+++ b/drivers/i2c/busses/i2c-qcom-geni.c
@@ -857,6 +857,7 @@ static int geni_i2c_probe(struct platform_device *pdev)
ret = geni_se_resources_on(&gi2c->se);
if (ret) {
dev_err(dev, "Error turning on resources %d\n", ret);
+ clk_disable_unprepare(gi2c->core_clk);
return ret;
}
proto = geni_se_read_proto(&gi2c->se);
@@ -876,8 +877,11 @@ static int geni_i2c_probe(struct platform_device *pdev)
/* FIFO is disabled, so we can only use GPI DMA */
gi2c->gpi_mode = true;
ret = setup_gpi_dma(gi2c);
- if (ret)
+ if (ret) {
+ geni_se_resources_off(&gi2c->se);
+ clk_disable_unprepare(gi2c->core_clk);
return dev_err_probe(dev, ret, "Failed to setup GPI DMA mode\n");
+ }
dev_dbg(dev, "Using GPI DMA mode for I2C\n");
} else {
@@ -890,6 +894,8 @@ static int geni_i2c_probe(struct platform_device *pdev)
if (!tx_depth) {
dev_err(dev, "Invalid TX FIFO depth\n");
+ geni_se_resources_off(&gi2c->se);
+ clk_disable_unprepare(gi2c->core_clk);
return -EINVAL;
}