aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMasahiro Yamada <yamada.masahiro@socionext.com>2015-11-30 04:53:33 -0500
committerWolfram Sang <wsa@the-dreams.de>2015-12-14 04:58:44 -0500
commit1ff49b34bfd1261277d2c97ec48efb067b87f5e5 (patch)
treeab2dfb0ac4706371703e1c9fe2d2b85135eec213
parentca68eade666a6ad7e954cc8c1af07ce477726087 (diff)
i2c: uniphier: error out if clock rate is zero
This input clock is used to generate the sampling clock for I2C bus. If the clock rate is zero, there is something wrong with the clock driver. Bail out with the appropriate error message in such a case. It would make it easier to find the root cause of failure. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
-rw-r--r--drivers/i2c/busses/i2c-uniphier.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/i2c/busses/i2c-uniphier.c b/drivers/i2c/busses/i2c-uniphier.c
index e3c3861c3325..2b2c20b3a57a 100644
--- a/drivers/i2c/busses/i2c-uniphier.c
+++ b/drivers/i2c/busses/i2c-uniphier.c
@@ -342,6 +342,10 @@ static int uniphier_i2c_clk_init(struct device *dev,
342 return ret; 342 return ret;
343 343
344 clk_rate = clk_get_rate(priv->clk); 344 clk_rate = clk_get_rate(priv->clk);
345 if (!clk_rate) {
346 dev_err(dev, "input clock rate should not be zero\n");
347 return -EINVAL;
348 }
345 349
346 uniphier_i2c_reset(priv, true); 350 uniphier_i2c_reset(priv, true);
347 351
@@ -388,7 +392,7 @@ static int uniphier_i2c_probe(struct platform_device *pdev)
388 392
389 ret = uniphier_i2c_clk_init(dev, priv); 393 ret = uniphier_i2c_clk_init(dev, priv);
390 if (ret) 394 if (ret)
391 return ret; 395 goto err;
392 396
393 ret = devm_request_irq(dev, irq, uniphier_i2c_interrupt, 0, pdev->name, 397 ret = devm_request_irq(dev, irq, uniphier_i2c_interrupt, 0, pdev->name,
394 priv); 398 priv);