Linux kernel and device drivers for NXP i.MX platforms
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Mehmet Fide" <mehmet.fide@gmail.com>
Cc: imx@lists.linux.dev, Frank.Li@kernel.org
Subject: Re: [PATCH 1/2] i2c: imx: do not carry the interrupt status over to the next transfer
Date: Fri, 13 Nov 2026 07:46:59 +0000	[thread overview]
Message-ID: <sashiko-outbox-212366@kernel.org> (raw)
In-Reply-To: <20261113073250.1037215-2-mehmet.fide@gmail.com>

Thank you for your contribution! Sashiko AI review found no new issues
in this patch, but noticed 1 related pre-existing issue it does not
introduce:
- [High] i2c: imx: incorrect message index for I2C_M_RECV_LEN check in
  i2c_imx_xfer_common() [1]
--

commit 264afe43ed92a8a97214ca4df23166f59bf1e387
Author: Mehmet Fide <mehmet.fide@screeningeagle.com>

i2c: imx: do not carry the interrupt status over to the next transfer

This commit clears i2c_imx->i2csr at the start of i2c_imx_xfer_common() so
that stale interrupt status from a failed DMA transfer does not cause a
subsequent DMA read to complete prematurely.

> diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c
> index ccf08cd63151f..1987a0fd81329 100644
> --- a/drivers/i2c/busses/i2c-imx.c
> +++ b/drivers/i2c/busses/i2c-imx.c
> @@ -1657,6 +1657,8 @@ static int i2c_imx_xfer_common(struct i2c_adapter *adapter,
>  	if (result)
>  		return result;
>  
> +	i2c_imx->i2csr = 0;
> +
>  	/* Start I2C transfer */
>  	result = i2c_imx_start(i2c_imx, atomic);
>  	if (result) {

[Severity: High]
This problem wasn't introduced by this patch, but should block_data check
msgs[i].flags instead of msgs->flags [1] in the message loop of
i2c_imx_xfer_common()?

drivers/i2c/busses/i2c-imx.c:i2c_imx_xfer_common() {
    ...
		if (msgs[i].flags & I2C_M_RD) {
			int block_data = msgs->flags & I2C_M_RECV_LEN;

			if (atomic)
				result = i2c_imx_atomic_read(i2c_imx, &msgs[i], is_lastmsg);
			else if (use_dma && !block_data)
				result = i2c_imx_dma_read(i2c_imx, &msgs[i], is_lastmsg);
    ...
}

In a combined transfer such as an SMBus block read where msgs[0] is a
command write and msgs[1] is a DMA-eligible read with I2C_M_RECV_LEN set,
msgs->flags tests msgs[0].flags, so block_data is 0 for msgs[1].  That
routes msgs[1] to i2c_imx_dma_read(), which does not parse the initial
SMBus block length byte and corrupts or fails the read.

[1] https://sashiko.dev/#/bug/linux-f62df5ed-ad96-43f2-872a-ae2c0100b73f

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261113073250.1037215-1-mehmet.fide@gmail.com?part=1

  reply	other threads:[~2026-11-13  7:47 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-13  7:32 [PATCH 0/2] i2c: imx: two fixes for a DMA write that is not acknowledged Mehmet Fide
2026-11-13  7:32 ` [PATCH 1/2] i2c: imx: do not carry the interrupt status over to the next transfer Mehmet Fide
2026-11-13  7:46   ` sashiko-bot [this message]
2026-11-13  7:32 ` [PATCH 2/2] i2c: imx: return -ENXIO at once when a DMA write is not acknowledged Mehmet Fide
2026-11-13  7:47   ` sashiko-bot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=sashiko-outbox-212366@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=Frank.Li@kernel.org \
    --cc=imx@lists.linux.dev \
    --cc=mehmet.fide@gmail.com \
    --cc=sashiko-reviews@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox