Patch "i2c: imx-lpi2c: return -EINVAL when i2c peripheral clk doesn't work" has been added to the 6.4-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    i2c: imx-lpi2c: return -EINVAL when i2c peripheral clk doesn't work

to the 6.4-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     i2c-imx-lpi2c-return-einval-when-i2c-peripheral-clk-.patch
and it can be found in the queue-6.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit b11cb2f0a9ccd77f59928aa09f6425c74390799c
Author: Carlos Song <carlos.song@xxxxxxx>
Date:   Wed Jul 26 17:22:38 2023 +0800

    i2c: imx-lpi2c: return -EINVAL when i2c peripheral clk doesn't work
    
    [ Upstream commit b610c4bbd153c2cde548db48559e170905d7c369 ]
    
    On MX8X platforms, the default clock rate is 0 if without explicit
    clock setting in dts nodes. I2c can't work when i2c peripheral clk
    rate is 0.
    
    Add a i2c peripheral clk rate check before configuring the clock
    register. When i2c peripheral clk rate is 0 and directly return
    -EINVAL.
    
    Signed-off-by: Carlos Song <carlos.song@xxxxxxx>
    Acked-by: Dong Aisheng <Aisheng.dong@xxxxxxx>
    Reviewed-by: Andi Shyti <andi.shyti@xxxxxxxxxx>
    Signed-off-by: Wolfram Sang <wsa@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/i2c/busses/i2c-imx-lpi2c.c b/drivers/i2c/busses/i2c-imx-lpi2c.c
index 4d24ceb57ee74..338171f76daf7 100644
--- a/drivers/i2c/busses/i2c-imx-lpi2c.c
+++ b/drivers/i2c/busses/i2c-imx-lpi2c.c
@@ -209,6 +209,9 @@ static int lpi2c_imx_config(struct lpi2c_imx_struct *lpi2c_imx)
 	lpi2c_imx_set_mode(lpi2c_imx);
 
 	clk_rate = clk_get_rate(lpi2c_imx->clks[0].clk);
+	if (!clk_rate)
+		return -EINVAL;
+
 	if (lpi2c_imx->mode == HS || lpi2c_imx->mode == ULTRA_FAST)
 		filt = 0;
 	else



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux