Skip to content
Commit 49d4db39 authored by Quan Nguyen's avatar Quan Nguyen Committed by Wolfram Sang
Browse files

i2c: designware: Correct length byte validation logic



Commit 0daede80 ("i2c: designware: Convert driver to using regmap API")
changes the logic to validate the whole 32-bit return value of
DW_IC_DATA_CMD register instead of 8-bit LSB without reason.

Later, commit f53f15ba ("i2c: designware: Get right data length"),
introduced partial fix but not enough because the "tmp > 0" still test
tmp as 32-bit value and is wrong in case the IC_DATA_CMD[11] is set.

Revert the logic to just before commit 0daede80
("i2c: designware: Convert driver to using regmap API").

Fixes: f53f15ba ("i2c: designware: Get right data length")
Fixes: 0daede80 ("i2c: designware: Convert driver to using regmap API")
Cc: stable@vger.kernel.org
Signed-off-by: default avatarTam Nguyen <tamnguyenchi@os.amperecomputing.com>
Signed-off-by: default avatarQuan Nguyen <quan@os.amperecomputing.com>
Acked-by: default avatarJarkko Nikula <jarkko.nikula@linux.intel.com>
Link: https://lore.kernel.org/r/20230726080001.337353-2-tamnguyenchi@os.amperecomputing.com


Reviewed-by: default avatarAndi Shyti <andi.shyti@kernel.org>
Signed-off-by: default avatarWolfram Sang <wsa@kernel.org>
parent b610c4bb
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment