Skip to contentSkip to conversation

i2c-imx: Disable the clock on probe failure

PATCH Applied Fabio Estevam 2 participants 2 messages Oct 4, 2014 – Oct 6, 2014 1 message not in the archive

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 i2c-imx: Disable the clock on probe failure

From: Fabio Estevam <[email protected]>

In the case of errors during probe, we should disable i2c_imx->clk.

---
 drivers/i2c/busses/i2c-imx.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/i2c/busses/i2c-imx.c +6 -2
index ceff87c..c48e46a 100644
@@ -710,7 +710,7 @@ static int i2c_imx_probe(struct platform_device *pdev)
 				pdev->name, i2c_imx);
 	if (ret) {
 		dev_err(&pdev->dev, "can't claim irq %d\n", irq);
-		return ret;
+		goto clk_disable;
 	}
 
 	/* Init queue */
@@ -735,7 +735,7 @@ static int i2c_imx_probe(struct platform_device *pdev)
 	ret = i2c_add_numbered_adapter(&i2c_imx->adapter);
 	if (ret < 0) {
 		dev_err(&pdev->dev, "registration failed\n");
-		return ret;
+		goto clk_disable;
 	}
 
 	/* Set up platform driver data */
@@ -749,6 +749,10 @@ static int i2c_imx_probe(struct platform_device *pdev)
 	dev_info(&i2c_imx->adapter.dev, "IMX I2C adapter registered\n");
 
 	return 0;   /* Return OK */
+
+clk_disable:
+	clk_disable_unprepare(i2c_imx->clk);
+	return ret;
 }
 
 static int i2c_imx_remove(struct platform_device *pdev)
Signature · 1 line
1.9.1

A message that is not in the archive (sent off-list or not yet received): 1412425047-9323-1-git-send-email-festevam-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org