Re: [PATCH] Input: ili210x - widen firmware address types to u32

From: Dmitry Torokhov

Date: Mon Nov 30 2026 - 15:21:31 EST


Hi Aibing,

On Sun, Nov 29, 2026 at 05:03:41PM +0800, Aibing Chen wrote:
> Widen the address types to u32 so that the full 3-byte address range
> is usable and the upper byte in the write command reflects the actual
> address. For the CRC field, write 0x00 for the upper byte directly:
> CRC-CCITT always produces a 16-bit value, so the upper byte is
> constant, which also silences the Smatch warning about shifting a
> 16-bit value by 16.
>
> Suggested-by: sashiko-bot <sashiko-bot@xxxxxxxxxx>
> Signed-off-by: Aibing Chen <chenaibing@xxxxxxxxxxxxxxxxxxxx>

Please address the two issues Sashiko pointed out: widen ac_end and
df_end to u32 in ili210x_firmware_update() as well (otherwise 0x10000 is
still truncated back to 0 before reaching ili210x_do_firmware_update()),
and add the Fixes tag:

Fixes: c6ac8f0b4ca9 ("Input: ili210x - add ili251x firmware update support")

Please also keep the Reported-by and Closes tags for the kernel test
robot Smatch report from your earlier patch, and mark the respin as v2
so it is clear it supersedes the previous submission.

...
> @@ -717,7 +717,7 @@ static int ili251x_firmware_write_to_ic(struct device *dev, const u8 *fwbuf,
> u8 cmd_wr[10] = {
> REG_WRITE_ENABLE, 0x5a, 0xa5, dataflash,
> (end >> 16) & 0xff, (end >> 8) & 0xff, end & 0xff,
> - (crc >> 16) & 0xff, (crc >> 8) & 0xff, crc & 0xff
> + 0x00, (crc >> 8) & 0xff, crc & 0xff
> };

Please use put_unaligned_be24() instead of open-coding the byte shifts:

u8 cmd_wr[10] = { REG_WRITE_ENABLE, 0x5a, 0xa5, dataflash };

put_unaligned_be24(end, &cmd_wr[4]);
put_unaligned_be24(crc, &cmd_wr[7]);

Separately, as a follow-up cleanup patch, could you also update the
firmware update and cached-state helpers to take "struct ili210x *priv"
directly (starting from ili210x_firmware_update_store() and
ili210x_i2c_probe()) instead of bouncing between dev, client, and priv
and repeating to_i2c_client() / i2c_get_clientdata()? While at it,
ili210x_firmware_update() and the four ili251x_firmware_update_*()
helpers returning ssize_t can switch to int. (Keep
ili210x_hardware_reset() taking reset_gpio since probe calls it before
priv is allocated.)

Thanks.

--
Dmitry