Commit 043465b6 authored by Yang Yingliang's avatar Yang Yingliang Committed by Wolfram Sang

i2c: qcom-geni: fix missing clk_disable_unprepare() and geni_se_resources_off()

Add missing clk_disable_unprepare() and geni_se_resources_off() in the error
path in geni_i2c_probe().

Fixes: 14d02fba ("i2c: qcom-geni: add desc struct to prepare support for I2C Master Hub variant")
Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
Reviewed-by: default avatarAndi Shyti <andi.shyti@kernel.org>
Signed-off-by: default avatarWolfram Sang <wsa@kernel.org>
parent ceb6a6f0
...@@ -858,6 +858,7 @@ static int geni_i2c_probe(struct platform_device *pdev) ...@@ -858,6 +858,7 @@ static int geni_i2c_probe(struct platform_device *pdev)
ret = geni_se_resources_on(&gi2c->se); ret = geni_se_resources_on(&gi2c->se);
if (ret) { if (ret) {
dev_err(dev, "Error turning on resources %d\n", ret); dev_err(dev, "Error turning on resources %d\n", ret);
clk_disable_unprepare(gi2c->core_clk);
return ret; return ret;
} }
proto = geni_se_read_proto(&gi2c->se); proto = geni_se_read_proto(&gi2c->se);
...@@ -877,8 +878,11 @@ static int geni_i2c_probe(struct platform_device *pdev) ...@@ -877,8 +878,11 @@ static int geni_i2c_probe(struct platform_device *pdev)
/* FIFO is disabled, so we can only use GPI DMA */ /* FIFO is disabled, so we can only use GPI DMA */
gi2c->gpi_mode = true; gi2c->gpi_mode = true;
ret = setup_gpi_dma(gi2c); 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"); return dev_err_probe(dev, ret, "Failed to setup GPI DMA mode\n");
}
dev_dbg(dev, "Using GPI DMA mode for I2C\n"); dev_dbg(dev, "Using GPI DMA mode for I2C\n");
} else { } else {
...@@ -891,6 +895,8 @@ static int geni_i2c_probe(struct platform_device *pdev) ...@@ -891,6 +895,8 @@ static int geni_i2c_probe(struct platform_device *pdev)
if (!tx_depth) { if (!tx_depth) {
dev_err(dev, "Invalid TX FIFO depth\n"); dev_err(dev, "Invalid TX FIFO depth\n");
geni_se_resources_off(&gi2c->se);
clk_disable_unprepare(gi2c->core_clk);
return -EINVAL; return -EINVAL;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment