diff options
author | Arvind Yadav <arvind.yadav.cs@gmail.com> | 2017-05-31 12:27:44 +0530 |
---|---|---|
committer | Wolfram Sang <wsa@the-dreams.de> | 2017-06-19 16:28:58 +0200 |
commit | 56a6cb88657557edd84eabddd9f509d13b5b81c5 (patch) | |
tree | ea33863ed58da31f235a9ec3d6bc2575ae3d91f7 | |
parent | 5c8e3ab146de92800d516386cbb7040c90210b27 (diff) | |
download | linux-56a6cb88657557edd84eabddd9f509d13b5b81c5.tar.bz2 |
i2c: at91: Handle return value of clk_prepare_enable
clk_prepare_enable() can fail here and we must check its return value.
Also, add a missing clk_disable_unprepare().
Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Acked-by: Ludovic Desroches <ludovic.desroches@microchip.com>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
-rw-r--r-- | drivers/i2c/busses/i2c-at91.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/i2c/busses/i2c-at91.c b/drivers/i2c/busses/i2c-at91.c index fabbb9e49161..2525cd9bcbbd 100644 --- a/drivers/i2c/busses/i2c-at91.c +++ b/drivers/i2c/busses/i2c-at91.c @@ -1083,12 +1083,16 @@ static int at91_twi_probe(struct platform_device *pdev) dev_err(dev->dev, "no clock defined\n"); return -ENODEV; } - clk_prepare_enable(dev->clk); + rc = clk_prepare_enable(dev->clk); + if (rc) + return rc; if (dev->dev->of_node) { rc = at91_twi_configure_dma(dev, phy_addr); - if (rc == -EPROBE_DEFER) + if (rc == -EPROBE_DEFER) { + clk_disable_unprepare(dev->clk); return rc; + } } if (!of_property_read_u32(pdev->dev.of_node, "atmel,fifo-size", |