diff options
author | Masahiro Yamada <yamada.masahiro@socionext.com> | 2015-11-30 18:53:35 +0900 |
---|---|---|
committer | Wolfram Sang <wsa@the-dreams.de> | 2015-12-14 10:59:26 +0100 |
commit | ac9b91f39d86f04eeacfccb6b6113b1ffa001ec1 (patch) | |
tree | e508b40e2986bfb1e5a470d8a58d3eaa9198beff /drivers/i2c/busses | |
parent | 2d5d23b96a4a660d0d04455150570c6257d4ce25 (diff) | |
download | talos-obmc-linux-ac9b91f39d86f04eeacfccb6b6113b1ffa001ec1.tar.gz talos-obmc-linux-ac9b91f39d86f04eeacfccb6b6113b1ffa001ec1.zip |
i2c: uniphier_f: 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>
Diffstat (limited to 'drivers/i2c/busses')
-rw-r--r-- | drivers/i2c/busses/i2c-uniphier-f.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/i2c/busses/i2c-uniphier-f.c b/drivers/i2c/busses/i2c-uniphier-f.c index e8d03bcfe3e0..67109e1d66c3 100644 --- a/drivers/i2c/busses/i2c-uniphier-f.c +++ b/drivers/i2c/busses/i2c-uniphier-f.c @@ -481,6 +481,10 @@ static int uniphier_fi2c_clk_init(struct device *dev, return ret; clk_rate = clk_get_rate(priv->clk); + if (!clk_rate) { + dev_err(dev, "input clock rate should not be zero\n"); + return -EINVAL; + } uniphier_fi2c_reset(priv); @@ -531,7 +535,7 @@ static int uniphier_fi2c_probe(struct platform_device *pdev) ret = uniphier_fi2c_clk_init(dev, priv); if (ret) - return ret; + goto err; ret = devm_request_irq(dev, irq, uniphier_fi2c_interrupt, 0, pdev->name, priv); |