Commit fa747d75 authored by Martin Blumenstingl's avatar Martin Blumenstingl Committed by Neil Armstrong

drm/meson: Fix error handling when afbcd.ops->init fails

When afbcd.ops->init fails we need to free the struct drm_device. Also
all errors which come after afbcd.ops->init was successful need to exit
the AFBCD, just like meson_drv_unbind() does.

Fixes: d1b5e41e ("drm/meson: Add AFBCD module driver")
Signed-off-by: default avatarMartin Blumenstingl <martin.blumenstingl@googlemail.com>
Acked-by: default avatarNeil Armstrong <narmstrong@baylibre.com>
Signed-off-by: default avatarNeil Armstrong <narmstrong@baylibre.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20211230235515.1627522-3-martin.blumenstingl@googlemail.com
parent 04b8a5d9
...@@ -302,42 +302,42 @@ static int meson_drv_bind_master(struct device *dev, bool has_components) ...@@ -302,42 +302,42 @@ static int meson_drv_bind_master(struct device *dev, bool has_components)
if (priv->afbcd.ops) { if (priv->afbcd.ops) {
ret = priv->afbcd.ops->init(priv); ret = priv->afbcd.ops->init(priv);
if (ret) if (ret)
return ret; goto free_drm;
} }
/* Encoder Initialization */ /* Encoder Initialization */
ret = meson_encoder_cvbs_init(priv); ret = meson_encoder_cvbs_init(priv);
if (ret) if (ret)
goto free_drm; goto exit_afbcd;
if (has_components) { if (has_components) {
ret = component_bind_all(drm->dev, drm); ret = component_bind_all(drm->dev, drm);
if (ret) { if (ret) {
dev_err(drm->dev, "Couldn't bind all components\n"); dev_err(drm->dev, "Couldn't bind all components\n");
goto free_drm; goto exit_afbcd;
} }
} }
ret = meson_encoder_hdmi_init(priv); ret = meson_encoder_hdmi_init(priv);
if (ret) if (ret)
goto free_drm; goto exit_afbcd;
ret = meson_plane_create(priv); ret = meson_plane_create(priv);
if (ret) if (ret)
goto free_drm; goto exit_afbcd;
ret = meson_overlay_create(priv); ret = meson_overlay_create(priv);
if (ret) if (ret)
goto free_drm; goto exit_afbcd;
ret = meson_crtc_create(priv); ret = meson_crtc_create(priv);
if (ret) if (ret)
goto free_drm; goto exit_afbcd;
ret = request_irq(priv->vsync_irq, meson_irq, 0, drm->driver->name, drm); ret = request_irq(priv->vsync_irq, meson_irq, 0, drm->driver->name, drm);
if (ret) if (ret)
goto free_drm; goto exit_afbcd;
drm_mode_config_reset(drm); drm_mode_config_reset(drm);
...@@ -355,6 +355,9 @@ static int meson_drv_bind_master(struct device *dev, bool has_components) ...@@ -355,6 +355,9 @@ static int meson_drv_bind_master(struct device *dev, bool has_components)
uninstall_irq: uninstall_irq:
free_irq(priv->vsync_irq, drm); free_irq(priv->vsync_irq, drm);
exit_afbcd:
if (priv->afbcd.ops)
priv->afbcd.ops->exit(priv);
free_drm: free_drm:
drm_dev_put(drm); drm_dev_put(drm);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment