Skip to content

Commit

Permalink
i2c-imx: Disable the clock on probe failure
Browse files Browse the repository at this point in the history
In the case of errors during probe, we should disable i2c_imx->clk.

Signed-off-by: Fabio Estevam <[email protected]>
Signed-off-by: Wolfram Sang <[email protected]>
  • Loading branch information
Fabio Estevam authored and Wolfram Sang committed Oct 6, 2014
1 parent a445900 commit a4ce47f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions drivers/i2c/busses/i2c-imx.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand All @@ -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 */
Expand All @@ -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)
Expand Down

0 comments on commit a4ce47f

Please sign in to comment.