Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/msm: fix workqueue leak on bind errors

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

Since commit c3b790ea07a1 ("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: 060530f1ea67 ("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>

authored by

Johan Hovold and committed by
Dmitry Baryshkov
a75b49db ca090c83

+4 -1
+4 -1
drivers/gpu/drm/msm/msm_drv.c
··· 459 459 460 460 ret = msm_init_vram(ddev); 461 461 if (ret) 462 - goto err_put_dev; 462 + goto err_cleanup_mode_config; 463 463 464 464 /* Bind all our sub-components: */ 465 465 ret = component_bind_all(dev, ddev); ··· 564 564 565 565 err_deinit_vram: 566 566 msm_deinit_vram(ddev); 567 + err_cleanup_mode_config: 568 + drm_mode_config_cleanup(ddev); 569 + destroy_workqueue(priv->wq); 567 570 err_put_dev: 568 571 drm_dev_put(ddev); 569 572