From: Masahiro Yamada Date: Mon, 30 Nov 2015 09:53:33 +0000 (+0900) Subject: i2c: uniphier: error out if clock rate is zero X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=1ff49b34bfd1261277d2c97ec48efb067b87f5e5;p=linux-beck.git 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 Signed-off-by: Wolfram Sang --- 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, 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_i2c_reset(priv, true); @@ -388,7 +392,7 @@ static int uniphier_i2c_probe(struct platform_device *pdev) ret = uniphier_i2c_clk_init(dev, priv); if (ret) - return ret; + goto err; ret = devm_request_irq(dev, irq, uniphier_i2c_interrupt, 0, pdev->name, priv);