All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Diogo Silva" <diogompaissilva@gmail.com>
Cc: linux-sunxi@lists.linux.dev, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH] drm/sun4i: Remove dependency on DRM simple helpers
Date: Tue, 23 Jun 2026 21:23:36 +0000	[thread overview]
Message-ID: <20260623212337.4E8551F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260623-sun4i_simple-v1-1-fa6696df1fad@gmail.com>

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

Pre-existing issues:
- [High] This problem wasn't introduced by this patch, but the return value of `drm_encoder_init()` is ignored in `sun8i_dw_hdmi_bind()`, which leads to a potential kernel panic on the error path.
--

commit 2d6b8f73fd3be1e78f02ca32197b62b5da0fb174
Author: Diogo Silva <diogompaissilva@gmail.com>

drm/sun4i: Remove dependency on DRM simple helpers

Simple KMS helper are deprecated since they only add an intermediate layer
between drivers and the atomic modesetting. This patch removes the dependency
on drm simple helpers from sun4i DRM drivers.

> diff --git a/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c b/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c
> index 96532709c2a7e..9694ad142a7de 100644
> --- a/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c
> +++ b/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c
[ ... ]
> @@ -180,7 +183,8 @@ static int sun8i_dw_hdmi_bind(struct device *dev, struct device *master,
>  		goto err_disable_clk_tmds;
>  
>  	drm_encoder_helper_add(encoder, &sun8i_dw_hdmi_encoder_helper_funcs);
> -	drm_simple_encoder_init(drm, encoder, DRM_MODE_ENCODER_TMDS);
> +	drm_encoder_init(drm, encoder, &sun8i_dw_hdmi_encoder_funcs,
> +			 DRM_MODE_ENCODER_TMDS, NULL);

[Severity: High]
This isn't a bug introduced by this patch, but the return value of
drm_encoder_init() is ignored here in sun8i_dw_hdmi_bind().

If drm_encoder_init() fails, the encoder remains uninitialized. If a
subsequent initialization step like dw_hdmi_bind() then fails, the
execution jumps to the cleanup_encoder error path:

    cleanup_encoder:
            drm_encoder_cleanup(encoder);

Could calling drm_encoder_cleanup() on an uninitialized encoder cause a
kernel panic due to dereferencing NULL pointers (such as encoder->dev or a
zero-initialized list_head)? Should the return code of drm_encoder_init()
be checked and handled here?

>  
>  	plat_data->mode_valid = hdmi->quirks->mode_valid;
>  	plat_data->use_drm_infoframe = hdmi->quirks->use_drm_infoframe;

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260623-sun4i_simple-v1-1-fa6696df1fad@gmail.com?part=1

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

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-23 20:34 [PATCH] drm/sun4i: Remove dependency on DRM simple helpers Diogo Silva
2026-06-23 21:23 ` sashiko-bot [this message]
2026-06-27  6:55 ` Jernej Škrabec
2026-06-27 13:07   ` Diogo

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=20260623212337.4E8551F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=diogompaissilva@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-sunxi@lists.linux.dev \
    --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.