Skip to content

Commit

Permalink
drm/msm: fix workqueue leak on bind errors
Browse files Browse the repository at this point in the history
commit a75b49d upstream.

Make sure to destroy the workqueue also in case of early errors during
bind (e.g. a subcomponent failing to bind).

Since commit c3b790e ("drm: Manage drm_mode_config_init with
drmm_") the mode config will be freed when the drm device is released
also when using the legacy interface, but add an explicit cleanup for
consistency and to facilitate backporting.

Fixes: 060530f ("drm/msm: use componentised device support")
Cc: stable@vger.kernel.org      # 3.15
Cc: Rob Clark <robdclark@gmail.com>
Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Patchwork: https://patchwork.freedesktop.org/patch/525093/
Link: https://lore.kernel.org/r/20230306100722.28485-9-johan+linaro@kernel.org
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
jhovold authored and gregkh committed May 17, 2023
1 parent 5447115 commit 6e14762
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion drivers/gpu/drm/msm/msm_drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ static int msm_drm_init(struct device *dev, const struct drm_driver *drv)

ret = msm_init_vram(ddev);
if (ret)
goto err_put_dev;
goto err_cleanup_mode_config;

/* Bind all our sub-components: */
ret = component_bind_all(dev, ddev);
Expand Down Expand Up @@ -561,6 +561,9 @@ static int msm_drm_init(struct device *dev, const struct drm_driver *drv)

err_deinit_vram:
msm_deinit_vram(ddev);
err_cleanup_mode_config:
drm_mode_config_cleanup(ddev);
destroy_workqueue(priv->wq);
err_put_dev:
drm_dev_put(ddev);

Expand Down

0 comments on commit 6e14762

Please sign in to comment.