[PATCH v5 1/3] i2c: xiic: preserve PEC byte length in SMBus block read setup

Andi Shyti andi.shyti at kernel.org
Wed Sep 23 11:04:36 PDT 2026


Hi Abdurraham,

On Mon, Sep 21, 2026 at 11:25:36AM -0700, Abdurrahman Hussain wrote:
> xiic_smbus_block_read_setup() recalculates i2c->rx_msg->len based on the
> length byte returned by the device, but historically clobbered the PEC
> byte expectation the SMBus core had baked into msg->len. That dropped
> the PEC byte from the caller's buffer on the normal and chunked
> receive-fifo branches.

...

> Fixes: e4c1ff772e1a ("i2c: xiic: Add smbus_block_read functionality")

yes, I think the Fixes tag was needed here.

> Cc: stable at vger.kernel.org
> Acked-by: Michal Simek <michal.simek at amd.com>
> Signed-off-by: Abdurrahman Hussain <abdurrahman at nexthop.ai>

...

> +			/*
> +			 * Undo the setup-time padding before rx_msg is cleared,
> +			 * so the PEC check sees the right byte.
> +			 */
> +			if (i2c->rx_msg && i2c->smbus_actual_len)
> +				i2c->rx_msg->len = i2c->smbus_actual_len;

I think this restore needs to go also in xiic_recv_atomic.

Andi

> +
>  			/* this is the last part of the message */
>  			i2c->rx_msg = NULL;



More information about the linux-arm-kernel mailing list