All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] GPU: drm: meson inline drm_simple_encoder_init()
@ 2026-06-22 18:08 Liam Zuiderhoek
  2026-06-22 18:18 ` sashiko-bot
  0 siblings, 1 reply; 2+ messages in thread
From: Liam Zuiderhoek @ 2026-06-22 18:08 UTC (permalink / raw)
  To: tzimmermann; +Cc: linux-kernel, dri-devel, Liam Zuiderhoek

Inline the call to drm_simple_encoder_init() for meson,
as per the TODO list on docs.kernel.org/gpu/todo.html

Signed-off-by: Liam Zuiderhoek <zuiderhoekl@gmail.com>
---
 drivers/gpu/drm/meson/meson_encoder_hdmi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/meson/meson_encoder_hdmi.c b/drivers/gpu/drm/meson/meson_encoder_hdmi.c
index 55c0601df3c6..48ca6874d4a0 100644
--- a/drivers/gpu/drm/meson/meson_encoder_hdmi.c
+++ b/drivers/gpu/drm/meson/meson_encoder_hdmi.c
@@ -407,8 +407,8 @@ int meson_encoder_hdmi_probe(struct meson_drm *priv)
 	meson_encoder_hdmi->priv = priv;
 
 	/* Encoder */
-	ret = drm_simple_encoder_init(priv->drm, &meson_encoder_hdmi->encoder,
-				      DRM_MODE_ENCODER_TMDS);
+	ret = drm_encoder_init(priv->drm, &meson_encoder_hdmi->encoder,
+			       DRM_MODE_ENCODER_TMDS, NULL);
 	if (ret) {
 		dev_err_probe(priv->dev, ret, "Failed to init HDMI encoder\n");
 		goto err_put_node;
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] GPU: drm: meson inline drm_simple_encoder_init()
  2026-06-22 18:08 [PATCH] GPU: drm: meson inline drm_simple_encoder_init() Liam Zuiderhoek
@ 2026-06-22 18:18 ` sashiko-bot
  0 siblings, 0 replies; 2+ messages in thread
From: sashiko-bot @ 2026-06-22 18:18 UTC (permalink / raw)
  To: Liam Zuiderhoek; +Cc: dri-devel

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

New issues:
- [High] Incorrect inlining of `drm_simple_encoder_init()` omits the `funcs` parameter, passing 4 arguments to a function expecting at least 5, resulting in a severe type mismatch and a missing `drm_encoder_funcs` structure.

Pre-existing issues:
- [High] Failure to remove the DRM bridge on error paths leaves a dangling pointer in the global bridge list and permanently leaks the bridge container memory.
--

commit cff971d423a1058d9ded86a03517245fb14f47c1
Author: Liam Zuiderhoek <zuiderhoekl@gmail.com>

GPU: drm: meson inline drm_simple_encoder_init()

This patch replaces the drm_simple_encoder_init() call in the meson HDMI
encoder with a direct call to drm_encoder_init() as part of the DRM subsystem
TODO list.

> diff --git a/drivers/gpu/drm/meson/meson_encoder_hdmi.c b/drivers/gpu/drm/meson/meson_encoder_hdmi.c
> index 55c0601df3c62..48ca6874d4a01 100644
> --- a/drivers/gpu/drm/meson/meson_encoder_hdmi.c
> +++ b/drivers/gpu/drm/meson/meson_encoder_hdmi.c
> @@ -407,8 +407,8 @@ int meson_encoder_hdmi_probe(struct meson_drm *priv)
>  	meson_encoder_hdmi->priv = priv;
>  
>  	/* Encoder */
> -	ret = drm_simple_encoder_init(priv->drm, &meson_encoder_hdmi->encoder,
> -				      DRM_MODE_ENCODER_TMDS);
> +	ret = drm_encoder_init(priv->drm, &meson_encoder_hdmi->encoder,
> +			       DRM_MODE_ENCODER_TMDS, NULL);

[Severity: High]
Does this pass the correct number of arguments to drm_encoder_init()?

Looking at drm_encoder_init() in drm_encoder.c, it expects at least five
arguments:
drm_encoder_init(dev, encoder, funcs, encoder_type, name, ...)

With only four arguments provided here in meson_encoder_hdmi_probe(), this
appears to pass the integer DRM_MODE_ENCODER_TMDS into the const struct
drm_encoder_funcs *funcs parameter, and NULL into the encoder_type parameter,
omitting the name parameter entirely.

Will this cause a build failure, or a panic when funcs->destroy is later
dereferenced?

>  	if (ret) {
>  		dev_err_probe(priv->dev, ret, "Failed to init HDMI encoder\n");
>  		goto err_put_node;

[Severity: High]
This isn't a bug introduced by this patch, but does this error path need to
call drm_bridge_remove() to prevent a memory leak?

Earlier in meson_encoder_hdmi_probe(), the bridge is added to the global
bridge list:

	drm_bridge_add(&meson_encoder_hdmi->bridge);

If drm_encoder_init() fails and takes this goto err_put_node path, the
bridge remains in the global bridge list with an elevated refcount because
drm_bridge_remove() is not called.

Could this leave an orphaned bridge that permanently breaks the display
pipeline on subsequent probe retries?

>  	}

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-06-22 18:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-22 18:08 [PATCH] GPU: drm: meson inline drm_simple_encoder_init() Liam Zuiderhoek
2026-06-22 18:18 ` sashiko-bot

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.