Commit 86365003 authored by Akhil P Oommen's avatar Akhil P Oommen Committed by Rob Clark

drm/msm: Fix failure paths in msm_drm_init()

Ensure that we do drm_dev_put() when there is an early return in
msm_drm_init().
Signed-off-by: default avatarAkhil P Oommen <quic_akhilpo@quicinc.com>
Patchwork: https://patchwork.freedesktop.org/patch/515606/
Link: https://lore.kernel.org/r/20221221203925.v2.2.I49dfc3654040be61702e491f1aa63d3a5f308852@changeidSigned-off-by: default avatarRob Clark <robdclark@chromium.org>
parent dbeedbcb
...@@ -129,6 +129,9 @@ void msm_disp_snapshot_destroy(struct drm_device *drm_dev) ...@@ -129,6 +129,9 @@ void msm_disp_snapshot_destroy(struct drm_device *drm_dev)
} }
priv = drm_dev->dev_private; priv = drm_dev->dev_private;
if (!priv->kms)
return;
kms = priv->kms; kms = priv->kms;
if (kms->dump_worker) if (kms->dump_worker)
......
...@@ -150,6 +150,9 @@ static void msm_irq_uninstall(struct drm_device *dev) ...@@ -150,6 +150,9 @@ static void msm_irq_uninstall(struct drm_device *dev)
struct msm_drm_private *priv = dev->dev_private; struct msm_drm_private *priv = dev->dev_private;
struct msm_kms *kms = priv->kms; struct msm_kms *kms = priv->kms;
if (!priv->kms)
return;
kms->funcs->irq_uninstall(kms); kms->funcs->irq_uninstall(kms);
if (kms->irq_requested) if (kms->irq_requested)
free_irq(kms->irq, dev); free_irq(kms->irq, dev);
...@@ -267,8 +270,6 @@ static int msm_drm_uninit(struct device *dev) ...@@ -267,8 +270,6 @@ static int msm_drm_uninit(struct device *dev)
component_unbind_all(dev, ddev); component_unbind_all(dev, ddev);
ddev->dev_private = NULL; ddev->dev_private = NULL;
drm_dev_put(ddev);
destroy_workqueue(priv->wq); destroy_workqueue(priv->wq);
return 0; return 0;
...@@ -441,12 +442,12 @@ static int msm_drm_init(struct device *dev, const struct drm_driver *drv) ...@@ -441,12 +442,12 @@ static int msm_drm_init(struct device *dev, const struct drm_driver *drv)
ret = msm_init_vram(ddev); ret = msm_init_vram(ddev);
if (ret) if (ret)
return ret; goto err_drm_dev_put;
/* Bind all our sub-components: */ /* Bind all our sub-components: */
ret = component_bind_all(dev, ddev); ret = component_bind_all(dev, ddev);
if (ret) if (ret)
return ret; goto err_drm_dev_put;
dma_set_max_seg_size(dev, UINT_MAX); dma_set_max_seg_size(dev, UINT_MAX);
...@@ -541,6 +542,8 @@ static int msm_drm_init(struct device *dev, const struct drm_driver *drv) ...@@ -541,6 +542,8 @@ static int msm_drm_init(struct device *dev, const struct drm_driver *drv)
err_msm_uninit: err_msm_uninit:
msm_drm_uninit(dev); msm_drm_uninit(dev);
err_drm_dev_put:
drm_dev_put(ddev);
return ret; return ret;
} }
......
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