Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Alexey Minnekhanov" <alexeymin@minlexx.ru>
Cc: conor+dt@kernel.org, devicetree@vger.kernel.org, robh@kernel.org,
	dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v3 6/9] drm/panel: novatek-nt36672a: Add 3 panels used in Xiaomi phones
Date: Sun, 11 Oct 2026 12:05:52 +0000	[thread overview]
Message-ID: <sashiko-outbox-167214@kernel.org> (raw)
In-Reply-To: <20261011-nt36672a-panels-v3-6-9ea238627f8a@minlexx.ru>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Medium] drm: panel: missing accum_err reset skips panel sleep on deinit error
- [Medium] drm/panel: nt36672a: regulator leak in prepare() error path
--

commit 219f9f92346f508583b813b9a7fbcd8b92f75a49
Author: Alexey Minnekhanov <alexeymin@minlexx.ru>

drm/panel: novatek-nt36672a: Add 3 panels used in Xiaomi phones

Add support for 3 panels used in 2 Xiaomi smartphones, all based on
Qualcomm SDM636/660 SoC:

* Shenchao panel used in Xiaomi Redmi Note 7 (xiaomi-lavender), the
  exact model string is unknown
* Tianma TL063FVMC43-02  for Xiaomi Redmi Note 6 Pro (xiaomi-tulip)
* Tianma TL063FVMCA01-00 for Xiaomi Redmi Note 7 (xiaomi-lavender)

> diff --git a/drivers/gpu/drm/panel/panel-novatek-nt36672a.c b/drivers/gpu/drm/panel/panel-novatek-nt36672a.c
> index a445c8067aa5f..d356348d39608 100644
> --- a/drivers/gpu/drm/panel/panel-novatek-nt36672a.c
> +++ b/drivers/gpu/drm/panel/panel-novatek-nt36672a.c

[ ... ]

> +static void lavender_tulip_deinit_cmds(struct mipi_dsi_multi_context *dsi_ctx)
> +{
> +	dsi_ctx->dsi->mode_flags &= ~MIPI_DSI_MODE_LPM;
> +
> +	mipi_dsi_dcs_set_display_off_multi(dsi_ctx);
> +	mipi_dsi_msleep(dsi_ctx, 20);
> +	mipi_dsi_dcs_enter_sleep_mode_multi(dsi_ctx);
> +	mipi_dsi_msleep(dsi_ctx, 120);
> +}

[Severity: Medium]
If mipi_dsi_dcs_set_display_off_multi() fails, it sets dsi_ctx->accum_err to a
negative error code. Since there is no dsi_ctx->accum_err = 0; after it, will
the subsequent mipi_dsi_msleep() and mipi_dsi_dcs_enter_sleep_mode_multi()
calls immediately exit as no-ops?

This seems like it would abort the deinitialization sequence prematurely,
skipping the panel sleep command and required delays before system regulators
disable power.

For comparison, tianma_fhd_video_send_deinit_cmds() explicitly resets accum_err
to continue with the power-down sequence even if prior commands fail.

While looking at how the new send_init_cmds() function interacts with the
preparation path:

drivers/gpu/drm/panel/panel-novatek-nt36672a.c:nt36672a_panel_prepare() {
	...
	dsi_ctx.accum_err = nt36672a_panel_power_on(pinfo);

	/* send init cmds */
	if (pinfo->desc->send_init_cmds)
		pinfo->desc->send_init_cmds(&dsi_ctx);

	if (dsi_ctx.accum_err < 0)
		gpiod_set_value(pinfo->reset_gpio, 0);

	return dsi_ctx.accum_err;
}

[Severity: Medium]
If send_init_cmds() fails (for example due to a MIPI DSI write timeout) and
returns a negative dsi_ctx.accum_err, does this leak the regulator reference
count?

It looks like the error path pulls the reset GPIO low and returns the error
code, but fails to call nt36672a_panel_power_off() or regulator_bulk_disable()
to clean up the regulators enabled earlier by nt36672a_panel_power_on().

Since the DRM core's drm_panel_prepare() does not set the panel's prepared
flag to true on error, drm_panel_unprepare() will skip the unprepared panel,
leaving the regulators permanently enabled.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261011-nt36672a-panels-v3-0-9ea238627f8a@minlexx.ru?part=6

  reply	other threads:[~2026-10-11 12:05 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-11 11:54 [PATCH v3 0/9] drm/panel: novatek-nt36672a: Extend with 5 new panels Alexey Minnekhanov
2026-10-11 11:54 ` [PATCH v3 1/9] dt-bindings: vendor-prefixes: Add Shenzhen TXD Technology Co., Ltd Alexey Minnekhanov
2026-10-11 11:54 ` [PATCH v3 2/9] dt-bindings: vendor-prefixes: Add Shen Chao Optoelectronics Alexey Minnekhanov
2026-10-11 11:54 ` [PATCH v3 3/9] dt-bindings: display: novatek,nt36672a: Add 5 new panels Alexey Minnekhanov
2026-10-11 11:54 ` [PATCH v3 4/9] drm/panel: novatek-nt36672a: Set driver name to novatek for consistency Alexey Minnekhanov
2026-10-11 11:54 ` [PATCH v3 5/9] drm/panel: novatek-nt36672a: Combine two init callbacks into one Alexey Minnekhanov
2026-10-11 11:54 ` [PATCH v3 6/9] drm/panel: novatek-nt36672a: Add 3 panels used in Xiaomi phones Alexey Minnekhanov
2026-10-11 12:05   ` sashiko-bot [this message]
2026-10-11 11:54 ` [PATCH v3 7/9] drm/panel: novatek-nt36672a: Add Tianma panel for Xiaomi Mi A2 Alexey Minnekhanov
2026-10-11 12:04   ` sashiko-bot
2026-10-11 11:54 ` [PATCH v3 8/9] drm/panel: novatek-nt36672a: Add panel for Asus Zenfone Max Pro M1 Alexey Minnekhanov
2026-10-11 12:03   ` sashiko-bot
2026-10-11 11:54 ` [PATCH v3 9/9] MAINTAINERS: Add Alexey Minnekhanov as maintainer for NT36672A panel Alexey Minnekhanov

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-167214@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=alexeymin@minlexx.ru \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --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