mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-17 18:36:00 +00:00
drm/meson: fix unbind path if HDMI fails to bind
If the case the HDMI controller fails to bind, we try to unbind all components before calling drm_dev_put() which makes drm_bridge_detach() crash because unbinding the HDMI controller frees the bridge memory. The solution is the unbind all components at the end like in the remove path. Reviewed-by: Nicolas Belin <nbelin@baylibre.com> Tested-by: Nicolas Belin <nbelin@baylibre.com> Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org> Link: https://patchwork.freedesktop.org/patch/msgid/20230512-amlogic-v6-4-upstream-dsi-ccf-vim3-v5-8-56eb7a4d5b8e@linaro.org
This commit is contained in:
parent
25b3b35cd5
commit
6a04464298
@ -316,32 +316,34 @@ static int meson_drv_bind_master(struct device *dev, bool has_components)
|
|||||||
goto exit_afbcd;
|
goto exit_afbcd;
|
||||||
|
|
||||||
if (has_components) {
|
if (has_components) {
|
||||||
ret = component_bind_all(drm->dev, drm);
|
ret = component_bind_all(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");
|
||||||
|
/* Do not try to unbind */
|
||||||
|
has_components = false;
|
||||||
goto exit_afbcd;
|
goto exit_afbcd;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = meson_encoder_hdmi_init(priv);
|
ret = meson_encoder_hdmi_init(priv);
|
||||||
if (ret)
|
if (ret)
|
||||||
goto unbind_all;
|
goto exit_afbcd;
|
||||||
|
|
||||||
ret = meson_plane_create(priv);
|
ret = meson_plane_create(priv);
|
||||||
if (ret)
|
if (ret)
|
||||||
goto unbind_all;
|
goto exit_afbcd;
|
||||||
|
|
||||||
ret = meson_overlay_create(priv);
|
ret = meson_overlay_create(priv);
|
||||||
if (ret)
|
if (ret)
|
||||||
goto unbind_all;
|
goto exit_afbcd;
|
||||||
|
|
||||||
ret = meson_crtc_create(priv);
|
ret = meson_crtc_create(priv);
|
||||||
if (ret)
|
if (ret)
|
||||||
goto unbind_all;
|
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 unbind_all;
|
goto exit_afbcd;
|
||||||
|
|
||||||
drm_mode_config_reset(drm);
|
drm_mode_config_reset(drm);
|
||||||
|
|
||||||
@ -359,15 +361,18 @@ 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);
|
||||||
unbind_all:
|
|
||||||
if (has_components)
|
|
||||||
component_unbind_all(drm->dev, drm);
|
|
||||||
exit_afbcd:
|
exit_afbcd:
|
||||||
if (priv->afbcd.ops)
|
if (priv->afbcd.ops)
|
||||||
priv->afbcd.ops->exit(priv);
|
priv->afbcd.ops->exit(priv);
|
||||||
free_drm:
|
free_drm:
|
||||||
drm_dev_put(drm);
|
drm_dev_put(drm);
|
||||||
|
|
||||||
|
meson_encoder_hdmi_remove(priv);
|
||||||
|
meson_encoder_cvbs_remove(priv);
|
||||||
|
|
||||||
|
if (has_components)
|
||||||
|
component_unbind_all(dev, drm);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user