All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Johan Hovold" <johan@kernel.org>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH] drm/panel-edp: take i2c adapter module reference
Date: Thu, 16 Jul 2026 13:34:19 +0000	[thread overview]
Message-ID: <20260716133420.187131F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260716132245.1565121-1-johan@kernel.org>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] When the devicetree's `ddc-i2c-bus` property explicitly points to the DP AUX I2C adapter, the module and device references acquired by `of_get_i2c_adapter_by_node()` are leaked during error cleanup and driver removal.
--

--- Patch [1]: [PATCH] drm/panel-edp: take i2c adapter module reference ---
commit 2c5917c76c861a6fb28736134884b2a3575fb31a
Author: Johan Hovold <johan@kernel.org>

drm/panel-edp: take i2c adapter module reference

The i2c subsystem currently blocks during adapter deregistration
whenever there are consumers holding a reference.

Switch to using of_get_i2c_adapter_by_node() which also takes a
reference to the adapter module so that an attempt to unload the module
while in use fails gracefully instead of blocking uninterruptibly.

> diff --git a/drivers/gpu/drm/panel/panel-edp.c b/drivers/gpu/drm/panel/panel-edp.c
> index f66474d3ef65e..a65bfe50be817 100644
> --- a/drivers/gpu/drm/panel/panel-edp.c
> +++ b/drivers/gpu/drm/panel/panel-edp.c
> @@ -874,7 +874,7 @@ static int panel_edp_probe(struct device *dev, const struct panel_desc *desc,
>  
>  	ddc = of_parse_phandle(dev->of_node, "ddc-i2c-bus", 0);
>  	if (ddc) {
> -		panel->ddc = of_find_i2c_adapter_by_node(ddc);
> +		panel->ddc = of_get_i2c_adapter_by_node(ddc);
>  		of_node_put(ddc);

[ ... ]

> @@ -939,7 +939,7 @@ static int panel_edp_probe(struct device *dev, const struct panel_desc *desc,
>  	pm_runtime_disable(dev);
>  err_finished_ddc_init:
>  	if (panel->ddc && (!panel->aux || panel->ddc != &panel->aux->ddc))
> -		put_device(&panel->ddc->dev);
> +		i2c_put_adapter(panel->ddc);

[Severity: Medium]
If the devicetree's "ddc-i2c-bus" property explicitly points to the DP AUX I2C
adapter node, panel->ddc will equal &panel->aux->ddc.

While the check panel->ddc != &panel->aux->ddc was already present, switching
to of_get_i2c_adapter_by_node() means a module reference is now acquired here
if the node is parsed from the devicetree.

Does skipping i2c_put_adapter() in this case cause a module reference leak when
an error occurs during probe?

>  
>  	return err;
>  }
> @@ -984,7 +984,7 @@ static void panel_edp_remove(struct device *dev)
>  	pm_runtime_dont_use_autosuspend(dev);
>  	pm_runtime_disable(dev);
>  	if (panel->ddc && (!panel->aux || panel->ddc != &panel->aux->ddc))
> -		put_device(&panel->ddc->dev);
> +		i2c_put_adapter(panel->ddc);

[Severity: Medium]
Similarly, does this skip i2c_put_adapter() and leak the module reference
during driver removal if the devicetree explicitly pointed to the AUX DDC
adapter?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260716132245.1565121-1-johan@kernel.org?part=1

  reply	other threads:[~2026-07-16 13:34 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-16 13:22 [PATCH] drm/panel-edp: take i2c adapter module reference Johan Hovold
2026-07-16 13:34 ` sashiko-bot [this message]
2026-07-16 17:27 ` Doug Anderson

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=20260716133420.187131F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=johan@kernel.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.