All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Qianhui Xu" <xiaqinghuan@mail.ustc.edu.cn>,
	dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v2 4/4] drm/panel: novatek-nt36536: reject enable when prepare failed
Date: Tue, 01 Dec 2026 10:47:36 +0000	[thread overview]
Message-ID: <sashiko-outbox-243095@kernel.org> (raw)
In-Reply-To: <20261201103915.3503057-5-xiaqinghuan@mail.ustc.edu.cn>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] drm/panel: novatek_enable() reaches into drm_panel core
  panel->prepared state
--

commit a50376adf296c5b8a35b17ec581a70a2368b7e12
Author: Qianhui Xu <xiaqinghuan@mail.ustc.edu.cn>

drm/panel: novatek-nt36536: reject enable when prepare failed

This commit adds a novatek_enable() callback that checks panel->prepared and
returns -EIO so the panel is not marked enabled when novatek_prepare() fails.

> diff --git a/drivers/gpu/drm/panel/panel-novatek-nt36536.c b/drivers/gpu/drm/panel/panel-novatek-nt36536.c
> index 88a003f5a9441..698e7b85a8a76 100644
> --- a/drivers/gpu/drm/panel/panel-novatek-nt36536.c
> +++ b/drivers/gpu/drm/panel/panel-novatek-nt36536.c
> @@ -123,6 +123,12 @@ static int novatek_prepare(struct drm_panel *panel)
>  	return ret;
>  }
>  
> +static int novatek_enable(struct drm_panel *panel)
> +{
> +	/* The bridge enable chain can continue after a failed prepare callback. */
> +	return panel->prepared ? 0 : -EIO;
> +}
> +
>  static int novatek_off(struct mipi_dsi_multi_context *dsi_ctx)
>  {
>  	mipi_dsi_dcs_set_display_off_multi(dsi_ctx);
> @@ -186,6 +192,7 @@ static int novatek_get_modes(struct drm_panel *panel,
>  
>  static const struct drm_panel_funcs novatek_panel_funcs = {
>  	.prepare = novatek_prepare,
> +	.enable = novatek_enable,
>  	.unprepare = novatek_unprepare,
>  	.get_modes = novatek_get_modes,
>  };

[Severity: Low]
Should this panel->prepared check live in drm_panel_enable() instead of
adding a dummy novatek_enable() callback that reaches into core drm_panel
state?

Commit d2aacaf07395 ("drm/panel: Check for already prepared/enabled in
drm_panel") moved panel->prepared and panel->enabled tracking into
drivers/gpu/drm/drm_panel.c so individual panel drivers would not inspect
those fields directly.  Also, the commit message states that checking
panel->prepared in drm_panel_enable() would skip panels that never implement
prepare(), but drm_panel_prepare() sets panel->prepared = true even when
panel->funcs->prepare is NULL:

drivers/gpu/drm/drm_panel.c:drm_panel_prepare() {
	...
	if (panel->funcs && panel->funcs->prepare) {
		ret = panel->funcs->prepare(panel);
		if (ret < 0)
			goto exit;
	}
	panel->prepared = true;
	...
}

Handling !panel->prepared in drm_panel_enable() would avoid driver-specific
workarounds and keep behavior consistent across all panel drivers.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261201103915.3503057-1-xiaqinghuan@mail.ustc.edu.cn?part=4

      reply	other threads:[~2026-12-01 10:47 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-01 10:39 [PATCH v2 0/4] drm/panel: novatek-nt36536: mode additions and lifecycle fixes for CSOT PP8807HB1-1 Qianhui Xu
2026-12-01 10:39 ` [PATCH v2 1/4] drm/panel: novatek-nt36536: add 40Hz and 24Hz modes " Qianhui Xu
2026-12-01 10:46   ` sashiko-bot
2026-12-01 10:39 ` [PATCH v2 2/4] drm/panel: novatek-nt36536: finish setup before attaching DSI devices Qianhui Xu
2026-12-01 10:39 ` [PATCH v2 3/4] drm/panel: novatek-nt36536: power off on any prepare failure Qianhui Xu
2026-12-01 10:39 ` [PATCH v2 4/4] drm/panel: novatek-nt36536: reject enable when prepare failed Qianhui Xu
2026-12-01 10:47   ` sashiko-bot [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=sashiko-outbox-243095@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=xiaqinghuan@mail.ustc.edu.cn \
    /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.