All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Chris Morgan" <macroalpha82@gmail.com>
Cc: conor+dt@kernel.org, devicetree@vger.kernel.org, robh@kernel.org
Subject: Re: [PATCH V4 4/6] drm/panel: anbernic-td4310: Add RG Vita Pro panel
Date: Tue, 02 Jun 2026 21:55:43 +0000	[thread overview]
Message-ID: <20260602215544.3C6E81F00893@smtp.kernel.org> (raw)
In-Reply-To: <20260602212512.418166-5-macroalpha82@gmail.com>

Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
- [High] The `panel_anbernic_td4310_prepare` function incorrectly returns success (0) even when MIPI DSI DCS commands fail, silently masking initialization errors.
- [High] The enable GPIO is initialized to its active logical state during probe, driving the physical pin before the VDD regulator is enabled.
- [Low] Implicit declaration and undefined reference to `devm_drm_panel_add`, leading to a build failure.
--

commit ae79417c9bc07c168f26d7711393a542d43e2756
Author: Chris Morgan <macromorgan@hotmail.com>

drm/panel: anbernic-td4310: Add RG Vita Pro panel

The panel used by Anbernic in the RG Vita-Pro is a DSI panel based
on the TD4310 controller IC. It measures approximately 5.5 inches
diagonally and is 1080x1920 in resolution.

> diff --git a/drivers/gpu/drm/panel/panel-anbernic-td4310.c b/drivers/gpu/drm/panel/panel-anbernic-td4310.c
> new file mode 100644
> index 0000000000000..006716378a57c
> --- /dev/null
> +++ b/drivers/gpu/drm/panel/panel-anbernic-td4310.c
[ ... ]
> +static int panel_anbernic_td4310_prepare(struct drm_panel *panel)
> +{
> +	struct anbernic_panel_td4310 *ctx = panel_to_anbernic_panel_td4310(panel);
> +	struct mipi_dsi_device *dsi = ctx->dsi;
> +	struct mipi_dsi_multi_context dsi_ctx = { .dsi = dsi };
> +	int ret;
[ ... ]
> +	mipi_dsi_dcs_exit_sleep_mode_multi(&dsi_ctx);
> +	mipi_dsi_msleep(&dsi_ctx, ctx->panel_info->prepare_delay);
> +	mipi_dsi_dcs_set_display_on_multi(&dsi_ctx);
> +	mipi_dsi_msleep(&dsi_ctx, ctx->panel_info->prepare_delay);
> +
> +	if (dsi_ctx.accum_err)
> +		goto err_reset;

[Severity: High]
Does this code silently mask MIPI DSI initialization errors? If dsi_ctx.accum_err
is non-zero, this jumps to err_reset but returns the current value of ret, which
was previously set to 0. Should this update ret to dsi_ctx.accum_err before
jumping?

> +
> +	return 0;
> +
> +err_reset:
> +	gpiod_set_value_cansleep(ctx->enable_gpio, 0);
> +err_enable:
> +	regulator_disable(ctx->vdd);
> +	return ret;
> +}
[ ... ]
> +static int panel_anbernic_td4310_probe(struct mipi_dsi_device *dsi)
> +{
> +	struct device *dev = &dsi->dev;
> +	struct anbernic_panel_td4310 *ctx;
> +	int ret;
[ ... ]
> +	ctx->reset_gpio = devm_gpiod_get(dev, "reset", GPIOD_OUT_LOW);
> +	if (IS_ERR(ctx->reset_gpio))
> +		return dev_err_probe(dev, PTR_ERR(ctx->reset_gpio),
> +				     "Cannot get reset gpio\n");
> +
> +	ctx->enable_gpio = devm_gpiod_get_optional(dev, "enable", GPIOD_OUT_HIGH);

[Severity: High]
Is it safe to initialize the enable GPIO with GPIOD_OUT_HIGH here during probe?
This drives the physical pin to its active logic state before the VDD regulator
is enabled in panel_anbernic_td4310_prepare(), which could potentially back-power
the unpowered display controller.

> +	if (IS_ERR(ctx->enable_gpio))
> +		return dev_err_probe(dev, PTR_ERR(ctx->enable_gpio),
> +				     "Cannot get enable gpio\n");
> +
> +	ctx->vdd = devm_regulator_get(dev, "vdd");
> +	if (IS_ERR(ctx->vdd))
> +		return dev_err_probe(dev, PTR_ERR(ctx->vdd),
> +				     "Failed to request vdd regulator\n");
> +
> +	ctx->dsi = dsi;
> +	mipi_dsi_set_drvdata(dsi, ctx);
> +
> +	dsi->lanes = ctx->panel_info->lanes;
> +	dsi->format = ctx->panel_info->format;
> +	dsi->mode_flags = ctx->panel_info->mode_flags;
> +
> +	ret = drm_panel_of_backlight(&ctx->panel);
> +	if (ret)
> +		return ret;
> +
> +	devm_drm_panel_add(dev, &ctx->panel);

[Severity: Low]
Does this code build? The function devm_drm_panel_add() does not appear to exist
in the DRM panel API, which would cause an implicit declaration and undefined
reference compilation failure.

> +
> +	ret = devm_mipi_dsi_attach(dev, dsi);
> +	if (ret < 0)
> +		return dev_err_probe(dev, ret, "Failed to attach to DSI host\n");
> +
> +	return 0;
> +}

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260602212512.418166-1-macroalpha82@gmail.com?part=4

  reply	other threads:[~2026-06-02 21:55 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-02 21:25 [PATCH V4 0/6] Add Anbernic RG Vita-Pro Chris Morgan
2026-06-02 21:25 ` Chris Morgan
2026-06-02 21:25 ` [PATCH V4 1/6] dt-bindings: power: supply: sgm41542: document sgm41542 Chris Morgan
2026-06-02 21:25   ` Chris Morgan
2026-06-02 21:25 ` [PATCH V4 2/6] power: supply: sgm41542: Add SG Micro sgm41542 charger Chris Morgan
2026-06-02 21:25   ` Chris Morgan
2026-06-02 21:43   ` sashiko-bot
2026-06-04 21:58   ` Sebastian Reichel
2026-06-04 21:58     ` Sebastian Reichel
2026-06-02 21:25 ` [PATCH V4 3/6] dt-bindings: display: panel: document Anbernic TD4310 panel Chris Morgan
2026-06-02 21:25   ` Chris Morgan
2026-06-02 21:25 ` [PATCH V4 4/6] drm/panel: anbernic-td4310: Add RG Vita Pro panel Chris Morgan
2026-06-02 21:25   ` Chris Morgan
2026-06-02 21:55   ` sashiko-bot [this message]
2026-06-02 21:25 ` [PATCH V4 5/6] dt-bindings: arm: rockchip: Add Anbernic RG Vita-Pro Chris Morgan
2026-06-02 21:25   ` Chris Morgan
2026-06-02 21:25 ` [PATCH V4 6/6] arm64: dts: " Chris Morgan
2026-06-02 21:25   ` Chris Morgan
2026-06-02 22:06   ` sashiko-bot

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=20260602215544.3C6E81F00893@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=macroalpha82@gmail.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 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.