Re: [PATCH v1] i2c: designware: Handle invalid SMBus block data response length

From: Jarkko Nikula
Date: Mon Jun 05 2023 - 03:41:43 EST


Hi

On 6/2/23 07:30, Tam Chi Nguyen wrote:
Hi Jarkko,

Before pushing the v2 patch, I have one more question to ask.

The commit f53f15ba5a85 ("i2c: designware: Get right data length"), you mentioned,
does not handle bit 11 set (on a HW where it's supported) correctly.
"tmp" was not marked with DW_IC_DATA_CMD_DAT when passing to i2c_dw_recv_len function.

So I plan to update it in the v2 patch by adding this
    regmap_read(dev->map, DW_IC_DATA_CMD, &tmp);
    tmp &= DW_IC_DATA_CMD_DAT;

My question is: does it need a separate patch for this change?

I think for now bit 11 gets masked since tmp variable is assigned to u8 variables when calling i2c_dw_recv_len() and writing to *buf pointer but your proposal indeed makes code more robust both your patch point of view or any other future change. So separate patch makes sense in my opinion.