Skip to contentSkip to conversation

drm/meson: fix missing component unbind on bind errors

PATCH Applied Johan Hovold 4 participants 6 messages Mar 6, 2023 – Mar 22, 2023

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/meson: fix missing component unbind on bind errors

Make sure to unbind all subcomponents when binding the aggregate device fails.

Fixes a41e82e6c457 ("drm/meson: Add support for components")
Cc Neil Armstrong <[email protected]>

---

Note that this one has only been compile tested.

Johan

 drivers/gpu/drm/meson/meson_drv.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)
drivers/gpu/drm/meson/meson_drv.c +8 -5
index 79bfe3938d3c..7caf937c3c90 100644
@@ -325,23 +325,23 @@ static int meson_drv_bind_master(struct device *dev, bool has_components)
 
 	ret = meson_encoder_hdmi_init(priv);
 	if (ret)
-		goto exit_afbcd;
+		goto unbind_all;
 
 	ret = meson_plane_create(priv);
 	if (ret)
-		goto exit_afbcd;
+		goto unbind_all;
 
 	ret = meson_overlay_create(priv);
 	if (ret)
-		goto exit_afbcd;
+		goto unbind_all;
 
 	ret = meson_crtc_create(priv);
 	if (ret)
-		goto exit_afbcd;
+		goto unbind_all;
 
 	ret = request_irq(priv->vsync_irq, meson_irq, 0, drm->driver->name, drm);
 	if (ret)
-		goto exit_afbcd;
+		goto unbind_all;
 
 	drm_mode_config_reset(drm);
 
@@ -359,6 +359,9 @@ static int meson_drv_bind_master(struct device *dev, bool has_components)
 
 uninstall_irq:
 	free_irq(priv->vsync_irq, drm);
+unbind_all:
+	if (has_components)
+		component_unbind_all(drm->dev, drm);
 exit_afbcd:
 	if (priv->afbcd.ops)
 		priv->afbcd.ops->exit(priv);
Signature · 1 line
2.39.2
#1 lore raw

Hi Johan,

thanks for your patch!

On Mon, Mar 6, 2023 at 11:35 AM Johan Hovold <[email protected]> wrote:
[...]

drivers/gpu/drm/meson/meson_drv.c static int meson_drv_bind_master(struct device *dev, bool has_components) · line 326

Quoted 3 lines
drivers/gpu/drm/meson/meson_drv.c +0 -0
@@ -325,23 +325,23 @@ static int meson_drv_bind_master(struct device *dev, bool has_components)
 
        ret = meson_encoder_hdmi_init(priv);

I'm wondering if component_bind_all() can be moved further down. Right now it's between meson_encoder_cvbs_init() and meson_encoder_hdmi_init(). So it seems that encoders don't rely on component registration.

Unfortunately I am also not familiar with this and I'm hoping that Neil can comment on this.

Best regards,
Martin

#2 lore raw
Quoted 10 lines · Martin Blumenstingl

On Mon, Mar 6, 2023 at 11:35 AM Johan Hovold <[email protected]> wrote:
[...]

drivers/gpu/drm/meson/meson_drv.c static int meson_drv_bind_master(struct device *dev, bool has_components) · line 326

Quoted 3 lines
drivers/gpu/drm/meson/meson_drv.c +0 -0
@@ -325,23 +325,23 @@ static int meson_drv_bind_master(struct device *dev, bool has_components)
 
        ret = meson_encoder_hdmi_init(priv);

I'm wondering if component_bind_all() can be moved further down. Right now it's between meson_encoder_cvbs_init() and meson_encoder_hdmi_init(). So it seems that encoders don't rely on component registration.

Perhaps it can, but that would be a separate change (unless there is something inherently wrong with the current initialisation order).

Quoted 2 lines

Unfortunately I am also not familiar with this and I'm hoping that Neil can comment on this.

Any comments on this one, Neil?

Johan

maintainer Acked-by
#3 lore raw
Quoted 13 lines · Johan Hovold
Quoted 10 lines · Martin Blumenstingl

On Mon, Mar 6, 2023 at 11:35 AM Johan Hovold <[email protected]> wrote:
[...]

drivers/gpu/drm/meson/meson_drv.c static int meson_drv_bind_master(struct device *dev, bool has_components) · line 326

Quoted 3 lines
drivers/gpu/drm/meson/meson_drv.c +0 -0
@@ -325,23 +325,23 @@ static int meson_drv_bind_master(struct device *dev, bool has_components)
 
         ret = meson_encoder_hdmi_init(priv);

I'm wondering if component_bind_all() can be moved further down. Right now it's between meson_encoder_cvbs_init() and meson_encoder_hdmi_init(). So it seems that encoders don't rely on component registration.

Quoted 2 lines

Perhaps it can, but that would be a separate change (unless there is something inherently wrong with the current initialisation order).

The CVBS doesn't rely on any components unlike HDMI, this explains the current position of component_bind_all().

Quoted 5 lines
Quoted 3 lines

Unfortunately I am also not familiar with this and I'm hoping that Neil can comment on this.

Any comments on this one, Neil?

Yep, components should be bind for HDMI encoder/bridge init.

Anyway for this patch, sorry for the delay, but it's looks fine:

Quoted 2 lines

Johan