]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
i2c-imx: Disable the clock on probe failure
authorFabio Estevam <fabio.estevam@freescale.com>
Sat, 4 Oct 2014 12:17:27 +0000 (09:17 -0300)
committerWolfram Sang <wsa@the-dreams.de>
Mon, 6 Oct 2014 17:59:55 +0000 (19:59 +0200)
In the case of errors during probe, we should disable i2c_imx->clk.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
drivers/i2c/busses/i2c-imx.c

index ceff87cec18ec43b8c203c4b311ccb8029e1cb42..c48e46af670abec3314e63defc1662076c8008aa 100644 (file)
@@ -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)