MLK-17426 imx: lpi2c: add debug message when i2c peripheral clk doesn't work
authorGao Pan <pandy.gao@nxp.com>
Fri, 19 Jan 2018 06:30:36 +0000 (14:30 +0800)
committerNitin Garg <nitin.garg@nxp.com>
Tue, 20 Mar 2018 19:53:11 +0000 (14:53 -0500)
add debug message when i2c peripheral clk rate is 0, then
directly return -EINVAL.

Signed-off-by: Gao Pan <pandy.gao@nxp.com>
Reviewed-by: Andy Duan <fugang.duan@nxp.com>
drivers/i2c/busses/i2c-imx-lpi2c.c

index 7257e71..c2b08f9 100644 (file)
@@ -228,6 +228,11 @@ static int lpi2c_imx_config(struct lpi2c_imx_struct *lpi2c_imx)
        lpi2c_imx_set_mode(lpi2c_imx);
 
        clk_rate = clk_get_rate(lpi2c_imx->clk_per);
+       if (!clk_rate) {
+               dev_dbg(&lpi2c_imx->adapter.dev, "clk_per rate is 0\n");
+               return -EINVAL;
+       }
+
        if (lpi2c_imx->mode == HS || lpi2c_imx->mode == ULTRA_FAST)
                filt = 0;
        else