Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1380675

[PATCH v2 1/2] i2c: exynos5: Check clk_prepare_enable() return value

From Javier Martinez Canillas <javier@osg.samsung.com>
Newsgroups linux.kernel
Subject [PATCH v2 1/2] i2c: exynos5: Check clk_prepare_enable() return value
Date 2016-04-17 03:20 +0200
Message-ID <roJxw-4hm-1@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


The clk_prepare_enable() function can fail so check the return value
and propagate the error to the caller in case of a failure.

Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
---

Changes in v2: None

 drivers/i2c/busses/i2c-exynos5.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/drivers/i2c/busses/i2c-exynos5.c b/drivers/i2c/busses/i2c-exynos5.c
index b29c7500461a..ebbcba3de20a 100644
--- a/drivers/i2c/busses/i2c-exynos5.c
+++ b/drivers/i2c/busses/i2c-exynos5.c
@@ -671,7 +671,9 @@ static int exynos5_i2c_xfer(struct i2c_adapter *adap,
 		return -EIO;
 	}
 
-	clk_prepare_enable(i2c->clk);
+	ret = clk_prepare_enable(i2c->clk);
+	if (ret)
+		return ret;
 
 	for (i = 0; i < num; i++, msgs++) {
 		stop = (i == num - 1);
@@ -747,7 +749,9 @@ static int exynos5_i2c_probe(struct platform_device *pdev)
 		return -ENOENT;
 	}
 
-	clk_prepare_enable(i2c->clk);
+	ret = clk_prepare_enable(i2c->clk);
+	if (ret)
+		return ret;
 
 	mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	i2c->regs = devm_ioremap_resource(&pdev->dev, mem);
@@ -830,7 +834,9 @@ static int exynos5_i2c_resume_noirq(struct device *dev)
 	struct exynos5_i2c *i2c = platform_get_drvdata(pdev);
 	int ret = 0;
 
-	clk_prepare_enable(i2c->clk);
+	ret = clk_prepare_enable(i2c->clk);
+	if (ret)
+		return ret;
 
 	ret = exynos5_hsi2c_clock_setup(i2c);
 	if (ret) {
-- 
2.5.5

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH v2 1/2] i2c: exynos5: Check clk_prepare_enable() return value Javier Martinez Canillas <javier@osg.samsung.com> - 2016-04-17 03:20 +0200
  [PATCH v2 2/2] i2c: exynos5: Fix possible ABBA deadlock by keeping I2C clock prepared Javier Martinez Canillas <javier@osg.samsung.com> - 2016-04-17 03:20 +0200
    Re: [PATCH v2 2/2] i2c: exynos5: Fix possible ABBA deadlock by  keeping I2C clock prepared Krzysztof Kozlowski <k.kozlowski@samsung.com> - 2016-04-17 15:40 +0200
    Re: [PATCH v2 2/2] i2c: exynos5: Fix possible ABBA deadlock by  keeping I2C clock prepared Wolfram Sang <wsa@the-dreams.de> - 2016-04-22 15:40 +0200
  Re: [PATCH v2 1/2] i2c: exynos5: Check clk_prepare_enable() return  value Krzysztof Kozlowski <k.kozlowski@samsung.com> - 2016-04-17 15:40 +0200

csiph-web