1
0
Fork 0
mirror of synced 2025-03-06 20:59:54 +01:00

drm/msm: Add missing check and destroy for alloc_ordered_workqueue

Add check for the return value of alloc_ordered_workqueue as it may return
NULL pointer.
Moreover, use the destroy_workqueue in the later fails in order to avoid
memory leak.

Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Patchwork: https://patchwork.freedesktop.org/patch/517419/
Link: https://lore.kernel.org/r/20230109022038.2163-1-jiasheng@iscas.ac.cn
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
This commit is contained in:
Jiasheng Jiang 2023-01-09 10:20:38 +08:00 committed by Dmitry Baryshkov
parent d839f0811a
commit 643b7d0869

View file

@ -418,6 +418,9 @@ static int msm_drm_init(struct device *dev, const struct drm_driver *drv)
priv->dev = ddev;
priv->wq = alloc_ordered_workqueue("msm", 0);
if (!priv->wq)
return -ENOMEM;
priv->hangcheck_period = DRM_MSM_HANGCHECK_DEFAULT_PERIOD;
INIT_LIST_HEAD(&priv->objects);
@ -441,12 +444,12 @@ static int msm_drm_init(struct device *dev, const struct drm_driver *drv)
ret = msm_init_vram(ddev);
if (ret)
return ret;
goto err_msm_uninit;
/* Bind all our sub-components: */
ret = component_bind_all(dev, ddev);
if (ret)
return ret;
goto err_msm_uninit;
dma_set_max_seg_size(dev, UINT_MAX);