Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Marc-Olivier Champagne" <marc-olivier.champagne@savoirfairelinux.com>
Cc: devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org,
	dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 2/5] drm: panel: jd9365da: Add prepare_prev_first flag to drm_panel
Date: Wed, 08 Jul 2026 21:53:59 +0000	[thread overview]
Message-ID: <20260708215359.EB23A1F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260708213500.1867092-3-marc-olivier.champagne@savoirfairelinux.com>

Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:

New issues:
- [Low] Redundant duplicate assignment of `prepare_prev_first` flag.

Pre-existing issues:
- [High] Missing cleanup in the error paths of `jadard_prepare()` causes a permanent leak of the regulator enable counts.
- [High] Premature publication of the panel in `jadard_dsi_probe()` allows a race condition leading to a NULL pointer dereference.
--

--- Patch [2]: [PATCH 2/5] drm: panel: jd9365da: Add prepare_prev_first flag to drm_panel ---
commit 1a793dbc7476444fc7003da84dbce8a3bff9ad98
Author: Marc-Olivier Champagne <marc-olivier.champagne@savoirfairelinux.com>

drm: panel: jd9365da: Add prepare_prev_first flag to drm_panel

The DSI host must be enabled for the panel to be initialized in
prepare(). Set the prepare_prev_first flag to guarantee this.
This fixes the panel operation on Renesas RZ/G2LC SoC DSI host.

> diff --git a/drivers/gpu/drm/panel/panel-jadard-jd9365da-h3.c b/drivers/gpu/drm/panel/panel-jadard-jd9365da-h3.c
> index 1ef0c937863a2..a79dc8f8d5af9 100644
> --- a/drivers/gpu/drm/panel/panel-jadard-jd9365da-h3.c
> +++ b/drivers/gpu/drm/panel/panel-jadard-jd9365da-h3.c
> @@ -2993,6 +2993,8 @@ static int jadard_dsi_probe(struct mipi_dsi_device *dsi)
>  		return dev_err_probe(&dsi->dev, PTR_ERR(jadard->vccio),
>  				"failed to get vccio regulator\n");
>  
> +	jadard->panel.prepare_prev_first = true;
> +

[Severity: Low]
Does this introduce a redundant assignment?

Looking further down in jadard_dsi_probe(), the exact same flag appears to be
set again just before panel registration:

jadard_dsi_probe() {
	...
	jadard->panel.prepare_prev_first = true;

	drm_panel_add(&jadard->panel);
	...
}

Can we remove one of these duplicate assignments?

[Severity: High]
This is a pre-existing issue, but does jadard_prepare() leak regulator
reference counts on error paths?

If regulator_enable(jadard->vccio) succeeds, but a subsequent step fails:

jadard_prepare() {
	...
	ret = regulator_enable(jadard->vccio);
	...
	ret = regulator_enable(jadard->vdd);
	if (ret)
		return ret;

and later with mipi_dsi_dcs_nop():

	ret = mipi_dsi_dcs_nop(jadard->dsi);
	if (ret)
		return ret;
}

The function returns without disabling the previously enabled regulators.
Because the panel prepare fails, the DRM core won't mark it as prepared, and
jadard_unprepare() will never be called to clean up.
    
Can this prevent the system from entering low-power states or re-initializing
the display properly?

[Severity: High]
This isn't a bug introduced by this patch, but is there a race condition with
premature panel publication in jadard_dsi_probe()?

The panel is added to the global list before its required internal pointers
are initialized:

jadard_dsi_probe() {
	...
	drm_panel_add(&jadard->panel);

	mipi_dsi_set_drvdata(dsi, jadard);
	jadard->dsi = dsi;
	jadard->desc = desc;
}

If a display controller finds the panel concurrently (e.g., via probe deferral
resolution) and calls drm_panel_prepare(), jadard_prepare() could execute
before jadard_dsi_probe() finishes:

jadard_prepare() {
	...
	if (jadard->desc->vcioo_to_lp11_delay_ms)
	...
}

Can this dereference a NULL jadard->desc pointer? Should drm_panel_add() be
moved to the very end of the probe function?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260708213500.1867092-1-marc-olivier.champagne@savoirfairelinux.com?part=2

  reply	other threads:[~2026-07-08 21:54 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-08 21:34 [PATCH 0/5] drm/panel: jd9365da: add support for DCLTek DT300250 Marc-Olivier Champagne
2026-07-08 21:34 ` [PATCH 1/5] drm: panel: jd9365da: Enable LPM mode Marc-Olivier Champagne
2026-07-08 21:34 ` [PATCH 2/5] drm: panel: jd9365da: Add prepare_prev_first flag to drm_panel Marc-Olivier Champagne
2026-07-08 21:53   ` sashiko-bot [this message]
2026-07-08 21:34 ` [PATCH 3/5] dt-bindings: vendor-prefixes: Add DCLTEK Marc-Olivier Champagne
2026-07-08 21:34 ` [PATCH 4/5] dt-bindings: display: panel: add compatible for DCLTek 300250 9.35in panel Marc-Olivier Champagne
2026-07-08 21:54   ` sashiko-bot
2026-07-08 21:35 ` [PATCH 5/5] drm: panel: jd9365da: Add DCLTek 300250 9.35in display Marc-Olivier Champagne

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=20260708215359.EB23A1F00A3A@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=marc-olivier.champagne@savoirfairelinux.com \
    --cc=robh@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox