Commit 07f952d5 authored by Leilk.Liu's avatar Leilk.Liu Committed by Greg Kroah-Hartman
Browse files

i2c: mediatek: fix potential incorrect use of I2C_MASTER_WRRD



[ Upstream commit b4921836 ]

The old IC does not support the I2C_MASTER_WRRD (write-then-read)
function, but the current code’s handling of i2c->auto_restart may
potentially lead to entering the I2C_MASTER_WRRD software flow,
resulting in unexpected bugs.

Instead of repurposing the auto_restart flag, add a separate flag
to signal I2C_MASTER_WRRD operations.

Also fix handling of msgs. If the operation (i2c->op) is
I2C_MASTER_WRRD, then the msgs pointer is incremented by 2.
For all other operations, msgs is simply incremented by 1.

Fixes: b2ed11e2 ("I2C: mediatek: Add driver for MediaTek MT8173 I2C controller")
Signed-off-by: default avatarLeilk.Liu <leilk.liu@mediatek.com>
Suggested-by: default avatarChen-Yu Tsai <wenst@chromium.org>
Reviewed-by: default avatarChen-Yu Tsai <wenst@chromium.org>
Signed-off-by: default avatarWolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent e8de297f
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment