From: neil.armstrong@linaro.org
To: Hsieh Hung-En <hungen3108@gmail.com>,
jesszhan0024@gmail.com, dianders@chromium.org, akoskovich@pm.me,
luca.weiss@fairphone.com
Cc: dmitry.baryshkov@oss.qualcomm.com,
maarten.lankhorst@linux.intel.com, mripard@kernel.org,
tzimmermann@suse.de, airlied@gmail.com, simona@ffwll.ch,
dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
Sashiko <sashiko-bot@kernel.org>
Subject: Re: [PATCH 1/3] drm/panel: novatek-nt37705: Fix prepare error cleanup
Date: Thu, 3 Dec 2026 10:32:01 +0100 [thread overview]
Message-ID: <e331d5ec-35df-4df4-8126-64164e96cb31@linaro.org> (raw)
In-Reply-To: <20261203051011.447841-2-hungen3108@gmail.com>
On 12/3/26 06:10, Hsieh Hung-En wrote:
> If mipi_dsi_picture_parameter_set() or mipi_dsi_compression_mode() fails
> in nt37705_prepare(), the error is returned directly without asserting
> reset_gpio or disabling the regulators. Because drm_panel_prepare() does
> not mark the panel as prepared on failure, nt37705_unprepare() will not
> be called, leaving reset deasserted and leaking the enable count on all
> three supplies (vddio, dvdd, vci) so they can no longer be powered off.
>
> Route all failure paths after nt37705_reset() through a shared error
> cleanup path that asserts reset_gpio and disables the supplies.
>
> Fixes: 9ffe0df0262b ("drm/panel: Add driver for Novatek NT37705 panel")
> Reported-by: Sashiko <sashiko-bot@kernel.org>
> Closes: https://lore.kernel.org/r/sashiko-outbox-165407@kernel.org
> Signed-off-by: Hsieh Hung-En <hungen3108@gmail.com>
> ---
> drivers/gpu/drm/panel/panel-novatek-nt37705.c | 13 ++++++++-----
> 1 file changed, 8 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/drm/panel/panel-novatek-nt37705.c b/drivers/gpu/drm/panel/panel-novatek-nt37705.c
> index 342e58591bab..a37bbd569ee5 100644
> --- a/drivers/gpu/drm/panel/panel-novatek-nt37705.c
> +++ b/drivers/gpu/drm/panel/panel-novatek-nt37705.c
> @@ -209,9 +209,7 @@ static int nt37705_prepare(struct drm_panel *panel)
> ret = nt37705_on(ctx);
> if (ret < 0) {
> dev_err(dev, "Failed to initialize panel: %d\n", ret);
> - gpiod_set_value_cansleep(ctx->reset_gpio, 1);
> - regulator_bulk_disable(ARRAY_SIZE(nt37705_supplies), ctx->supplies);
> - return ret;
> + goto err;
> }
>
> drm_dsc_pps_payload_pack(&pps, &ctx->dsc);
> @@ -219,18 +217,23 @@ static int nt37705_prepare(struct drm_panel *panel)
> ret = mipi_dsi_picture_parameter_set(ctx->dsi, &pps);
> if (ret < 0) {
> dev_err(panel->dev, "failed to transmit PPS: %d\n", ret);
> - return ret;
> + goto err;
> }
>
> ret = mipi_dsi_compression_mode(ctx->dsi, true);
> if (ret < 0) {
> dev_err(dev, "failed to enable compression mode: %d\n", ret);
> - return ret;
> + goto err;
> }
>
> msleep(28); /* TODO: Is this panel-dependent? */
>
> return 0;
> +
> +err:
> + gpiod_set_value_cansleep(ctx->reset_gpio, 1);
> + regulator_bulk_disable(ARRAY_SIZE(nt37705_supplies), ctx->supplies);
> + return ret;
> }
>
> static int nt37705_unprepare(struct drm_panel *panel)
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Thanks,
Neil
next prev parent reply other threads:[~2026-12-03 9:32 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-03 5:10 [PATCH 0/3] drm/panel: Convert nt37705 and rm69220 prepare() to _multi() Hsieh Hung-En
2026-12-03 5:10 ` [PATCH 1/3] drm/panel: novatek-nt37705: Fix prepare error cleanup Hsieh Hung-En
2026-12-03 9:32 ` neil.armstrong [this message]
2026-12-03 5:10 ` [PATCH 2/3] drm/panel: novatek-nt37705: Use mipi_dsi_*_multi() in prepare() Hsieh Hung-En
2026-12-03 9:33 ` neil.armstrong
2026-12-03 5:10 ` [PATCH 3/3] drm/panel: raydium-rm69220: " Hsieh Hung-En
2026-12-03 9:34 ` neil.armstrong
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=e331d5ec-35df-4df4-8126-64164e96cb31@linaro.org \
--to=neil.armstrong@linaro.org \
--cc=airlied@gmail.com \
--cc=akoskovich@pm.me \
--cc=dianders@chromium.org \
--cc=dmitry.baryshkov@oss.qualcomm.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=hungen3108@gmail.com \
--cc=jesszhan0024@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luca.weiss@fairphone.com \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=sashiko-bot@kernel.org \
--cc=simona@ffwll.ch \
--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
all inboxes | Powered by JetHome®