From: "Luca Ceresoli" <luca.ceresoli@bootlin.com>
To: "Laurent Pinchart" <laurent.pinchart@ideasonboard.com>,
"Luca Ceresoli" <luca.ceresoli@bootlin.com>
Cc: "Johan Hovold" <johan@kernel.org>,
<dri-devel@lists.freedesktop.org>, <devicetree@vger.kernel.org>,
"Thuan Nguyen" <thuan.nguyen-hong@banvien.com.vn>,
"Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
"Maxime Ripard" <mripard@kernel.org>,
"Thomas Zimmermann" <tzimmermann@suse.de>,
"Rob Herring" <robh@kernel.org>,
"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
"Conor Dooley" <conor+dt@kernel.org>,
"Geert Uytterhoeven" <geert+renesas@glider.be>,
"Magnus Damm" <magnus.damm@gmail.com>,
"Andrzej Hajda" <andrzej.hajda@intel.com>,
"Neil Armstrong" <neil.armstrong@linaro.org>,
"Robert Foss" <rfoss@kernel.org>,
"Jonas Karlman" <jonas@kwiboo.se>,
"Jernej Skrabec" <jernej.skrabec@gmail.com>,
<linux-renesas-soc@vger.kernel.org>, <stable@vger.kernel.org>
Subject: Re: [PATCH 2/4] drm/bridge: display-connector: Fix I2C adapter resource leak
Date: Fri, 17 Jul 2026 22:06:51 +0200 [thread overview]
Message-ID: <DK148A1HSGJ4.1GZXWYTWPOZ6F@bootlin.com> (raw)
In-Reply-To: <20260717182802.GD1889304@killaraus.ideasonboard.com>
Hi Laurent,
On Fri Jul 17, 2026 at 8:28 PM CEST, Laurent Pinchart wrote:
> On Fri, Jul 17, 2026 at 05:21:11PM +0200, Luca Ceresoli wrote:
>> On Fri Jul 17, 2026 at 5:03 PM CEST, Johan Hovold wrote:
>> > On Mon, Jul 06, 2026 at 12:35:40AM +0300, Laurent Pinchart wrote:
>> >> If the probe function returns an error after getting the I2C adapter for
>> >> DDC, the reference to the adapter is never released. Fix it by releasing
>> >> it in the bridge .destroy() handler.
>> >>
>> >> There is no need to test the ddc pointer with !IS_ERR(), as
>> >> of_get_i2c_adapter_by_node() returns NULL on error.
>> >
>> > I stumbled over this this morning as well and posted a fix here (which
>> > releases the adapter on driver unbind as is currently done):
>> >
>> > https://lore.kernel.org/lkml/20260717085716.1619275-1-johan@kernel.org/
>> >
>> >> Fixes: 6de79dd3a920 ("drm/bridge: display-connector: add ddc-en gpio support")
>> >
>> > I believe this issue was first introduced by commit 2e2bf3a5584d
>> > ("drm/bridge: display-connector: add DP support") a few releases
>> > earlier.
>> >
>> >> Cc: stable@vger.kernel.org
>> >> Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
>> >
>> > Reviewed-by: Johan Hovold <johan@kernel.org>
>>
>> While Johan's patch has the benefit of putting the i2c adapter at remove
>> time (as opposed to destroy time, which is potentially a long time later),
>> it is also more complex. So I'd say this patch is fine.
>
> In this case putting the I2C adapter early is probably fine, but in
> general I really prefer reference-counting and releasing references at
> destroy time. This ensures that the resources stay available if they
> need to be accessed between .remove() and destruction (for instance in a
> .release() handler following a close() or munmap() from userspace). I
> think late release should be the default, as it's safer, and early
> release should be carefully reviewed when it's required.
Makes sense indeed.
Thanks for the clarification.
Luca
--
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
next prev parent reply other threads:[~2026-07-17 20:07 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-05 21:35 [PATCH 0/4] drm: bridge: display-connector: Support hardcoding EDID for VGA Laurent Pinchart
2026-07-05 21:35 ` [PATCH 1/4] dt-bindings: display: vga-connector: Allow hardcoding EDID Laurent Pinchart
2026-07-06 8:08 ` Geert Uytterhoeven
2026-07-06 10:03 ` Laurent Pinchart
2026-07-06 8:52 ` Maxime Ripard
2026-07-06 9:45 ` Laurent Pinchart
2026-07-06 15:40 ` Maxime Ripard
2026-07-06 16:02 ` Laurent Pinchart
2026-07-07 7:46 ` Maxime Ripard
2026-07-07 8:01 ` Laurent Pinchart
2026-07-17 12:25 ` Laurent Pinchart
2026-07-16 20:44 ` Rob Herring
2026-07-05 21:35 ` [PATCH 2/4] drm/bridge: display-connector: Fix I2C adapter resource leak Laurent Pinchart
2026-07-05 21:48 ` sashiko-bot
2026-07-05 23:38 ` Laurent Pinchart
2026-07-17 15:03 ` Johan Hovold
2026-07-17 15:21 ` Luca Ceresoli
2026-07-17 18:28 ` Laurent Pinchart
2026-07-17 20:06 ` Luca Ceresoli [this message]
2026-07-17 18:42 ` Laurent Pinchart
2026-07-05 21:35 ` [PATCH 3/4] drm/bridge: display-connector: Support hardcoded EDID for VGA connectors Laurent Pinchart
2026-07-05 21:44 ` sashiko-bot
2026-07-05 23:38 ` Laurent Pinchart
2026-07-05 21:35 ` [PATCH 4/4] [DNI] arm64: dts: renesas: salvator: Add overlay for Dell P1911 VGA display Laurent Pinchart
2026-07-05 21:37 ` sashiko-bot
2026-07-05 23:39 ` Laurent Pinchart
2026-07-06 8:16 ` Geert Uytterhoeven
2026-07-06 9:48 ` Laurent Pinchart
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=DK148A1HSGJ4.1GZXWYTWPOZ6F@bootlin.com \
--to=luca.ceresoli@bootlin.com \
--cc=andrzej.hajda@intel.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=geert+renesas@glider.be \
--cc=jernej.skrabec@gmail.com \
--cc=johan@kernel.org \
--cc=jonas@kwiboo.se \
--cc=krzk+dt@kernel.org \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=magnus.damm@gmail.com \
--cc=mripard@kernel.org \
--cc=neil.armstrong@linaro.org \
--cc=rfoss@kernel.org \
--cc=robh@kernel.org \
--cc=stable@vger.kernel.org \
--cc=thuan.nguyen-hong@banvien.com.vn \
--cc=tzimmermann@suse.de \
/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