Skip to content

Commit e69b9bc

Browse files
wangxiaoningnxpwsakernel
authored andcommitted
i2c: imx-lpi2c: fix type char overflow issue when calculating the clock cycle
Claim clkhi and clklo as integer type to avoid possible calculation errors caused by data overflow. Fixes: a55fa9d ("i2c: imx-lpi2c: add low power i2c bus driver") Signed-off-by: Clark Wang <xiaoning.wang@nxp.com> Signed-off-by: Carlos Song <carlos.song@nxp.com> Reviewed-by: Andi Shyti <andi.shyti@kernel.org> Signed-off-by: Wolfram Sang <wsa@kernel.org>
1 parent cd94896 commit e69b9bc

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/i2c/busses/i2c-imx-lpi2c.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,8 +201,8 @@ static void lpi2c_imx_stop(struct lpi2c_imx_struct *lpi2c_imx)
201201
/* CLKLO = I2C_CLK_RATIO * CLKHI, SETHOLD = CLKHI, DATAVD = CLKHI/2 */
202202
static int lpi2c_imx_config(struct lpi2c_imx_struct *lpi2c_imx)
203203
{
204-
u8 prescale, filt, sethold, clkhi, clklo, datavd;
205-
unsigned int clk_rate, clk_cycle;
204+
u8 prescale, filt, sethold, datavd;
205+
unsigned int clk_rate, clk_cycle, clkhi, clklo;
206206
enum lpi2c_imx_pincfg pincfg;
207207
unsigned int temp;
208208

0 commit comments

Comments
 (0)