From: Guennadi Liakhovetski Date: Thu, 12 Sep 2013 12:36:47 +0000 (+0200) Subject: i2c: rcar: fix clk_get() error handling X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=330c824a49cd49dd7e61c1e397fa4e7380ba2c68;p=linux-beck.git i2c: rcar: fix clk_get() error handling When clk_get() fails, it returns an error code, not a NULL. This patch fixes such an error handling bug. Signed-off-by: Guennadi Liakhovetski Signed-off-by: Wolfram Sang --- diff --git a/drivers/i2c/busses/i2c-rcar.c b/drivers/i2c/busses/i2c-rcar.c index 1f285a3be5c5..98276eb5f6e7 100644 --- a/drivers/i2c/busses/i2c-rcar.c +++ b/drivers/i2c/busses/i2c-rcar.c @@ -234,9 +234,9 @@ static int rcar_i2c_clock_calculate(struct rcar_i2c_priv *priv, u32 cdf_width; unsigned long rate; - if (!clkp) { - dev_err(dev, "there is no peripheral_clk\n"); - return -EIO; + if (IS_ERR(clkp)) { + dev_err(dev, "couldn't get clock\n"); + return PTR_ERR(clkp); } switch (priv->devtype) {