mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Geert Uytterhoeven" <geert+renesas@glider.be>
To: "Yige Jiang" <yigejiang86@gmail.com>,
	"Wolfram Sang" <wsa+renesas@sang-engineering.com>,
	"Andi Shyti" <andi.shyti@kernel.org>,
	"Magnus Damm" <magnus.damm@gmail.com>
Cc: linux-renesas-soc@vger.kernel.org, linux-i2c@vger.kernel.org,
	linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH] i2c: rcar: release DMA channels when host notify setup fails
Date: Thu, 26 Nov 2026 14:44:07 +0100	[thread overview]
Message-ID: <ec57d879-3b89-43d0-855d-723086e0a9fd@app.fastmail.com> (raw)
In-Reply-To: <rc-b1-20261110-vc-182-eee62ef398fd@gmail.com>

Hi Yige,

On Thu, Nov 26, 2026, at 14:31, Yige Jiang wrote:
> rcar_i2c_master_xfer() requests the DMA channels lazily, on the first
> transfer that finds priv->dma_tx or priv->dma_rx still set to
> ERR_PTR(-EPROBE_DEFER). Clients probed while i2c_add_numbered_adapter()
> registers the adapter can already issue such transfers, so the channels
> may be held by the time rcar_i2c_probe() creates the host notify client.
>
> If i2c_new_slave_host_notify_device() then fails, the out_del_device
> path deletes the adapter but does not call rcar_i2c_release_dma(); only
> rcar_i2c_remove() does. The channels then stay allocated, together with
> their DMA engine references, after probe has failed and priv is freed.
>
> Release the DMA channels right after deleting the adapter, in the same
> order as rcar_i2c_remove(). rcar_i2c_release_dma() skips channels that
> were never requested.
>
> Fixes: c4651f11d09a ("i2c: rcar: add HostNotify support")
> Cc: stable@vger.kernel.org
> Signed-off-by: Yige Jiang <yigejiang86@gmail.com>

Thanks for your patch!

> ---
> Based on linux-next next-20261109 (630059a5a632).
> Compile-tested: arm64, GCC 14.2.0, W=1, CONFIG_I2C_RCAR=m, 
> CONFIG_COMPILE_TEST=y (object only; no new warnings).
> No hardware or runtime test was performed.
> Needs a pre-Gen3 R-Car I2C node with the "smbus" property and dmas, a 

Why does it need a pre-Gen3 R-Car I2C node to trigger?
Pre-Gen3 I2C controller do not support DMA, so this cannot happen?

> client transfer during adapter registration, and a failing 
> i2c_new_slave_host_notify_device() (e.g. a client already at 0x08); no 
> in-tree DT sets "smbus" on an R-Car I2C node.

Gr{oetje,eeting}s,

                                                Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                                            -- Linus Torvalds

      reply	other threads:[~2026-11-26 13:44 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-26 13:31 Yige Jiang
2026-11-26 13:44 ` Geert Uytterhoeven [this message]

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=ec57d879-3b89-43d0-855d-723086e0a9fd@app.fastmail.com \
    --to=geert+renesas@glider.be \
    --cc=andi.shyti@kernel.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=magnus.damm@gmail.com \
    --cc=stable@vger.kernel.org \
    --cc=wsa+renesas@sang-engineering.com \
    --cc=yigejiang86@gmail.com \
    /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

all inboxes | Powered by JetHome®