Commit 56a6cb88 authored by Arvind Yadav's avatar Arvind Yadav Committed by Wolfram Sang

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: default avatarArvind Yadav <arvind.yadav.cs@gmail.com>
Acked-by: default avatarLudovic Desroches <ludovic.desroches@microchip.com>
Signed-off-by: default avatarWolfram Sang <wsa@the-dreams.de>
parent 5c8e3ab1
...@@ -1083,12 +1083,16 @@ static int at91_twi_probe(struct platform_device *pdev) ...@@ -1083,12 +1083,16 @@ static int at91_twi_probe(struct platform_device *pdev)
dev_err(dev->dev, "no clock defined\n"); dev_err(dev->dev, "no clock defined\n");
return -ENODEV; return -ENODEV;
} }
clk_prepare_enable(dev->clk); rc = clk_prepare_enable(dev->clk);
if (rc)
return rc;
if (dev->dev->of_node) { if (dev->dev->of_node) {
rc = at91_twi_configure_dma(dev, phy_addr); rc = at91_twi_configure_dma(dev, phy_addr);
if (rc == -EPROBE_DEFER) if (rc == -EPROBE_DEFER) {
clk_disable_unprepare(dev->clk);
return rc; return rc;
}
} }
if (!of_property_read_u32(pdev->dev.of_node, "atmel,fifo-size", if (!of_property_read_u32(pdev->dev.of_node, "atmel,fifo-size",
......
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