* [PATCH v2] drm/msm: Add missing check and destroy for alloc_ordered_workqueue
@ 2023-01-09 2:20 Jiasheng Jiang
2023-01-18 1:24 ` Dmitry Baryshkov
2023-01-18 2:06 ` Dmitry Baryshkov
0 siblings, 2 replies; 3+ messages in thread
From: Jiasheng Jiang @ 2023-01-09 2:20 UTC (permalink / raw)
To: dmitry.baryshkov, robdclark, quic_abhinavk, sean, airlied,
sumit.semwal, christian.koenig
Cc: linux-arm-msm, dri-devel, linux-kernel, linux-media,
linaro-mm-sig, freedreno, Jiasheng Jiang
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>
---
Changelog:
v1 -> v2:
1. Convert "goto err_destroy_workqueue" into "goto err_msm_unit" and
remove "err_destroy_workqueue" label.
---
drivers/gpu/drm/msm/msm_drv.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c
index 8b0b0ac74a6f..54be323ed33d 100644
--- a/drivers/gpu/drm/msm/msm_drv.c
+++ b/drivers/gpu/drm/msm/msm_drv.c
@@ -418,6 +418,8 @@ 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;
INIT_LIST_HEAD(&priv->objects);
mutex_init(&priv->obj_lock);
@@ -440,12 +442,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);
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2] drm/msm: Add missing check and destroy for alloc_ordered_workqueue
2023-01-09 2:20 [PATCH v2] drm/msm: Add missing check and destroy for alloc_ordered_workqueue Jiasheng Jiang
@ 2023-01-18 1:24 ` Dmitry Baryshkov
2023-01-18 2:06 ` Dmitry Baryshkov
1 sibling, 0 replies; 3+ messages in thread
From: Dmitry Baryshkov @ 2023-01-18 1:24 UTC (permalink / raw)
To: Jiasheng Jiang, robdclark, quic_abhinavk, sean, airlied,
sumit.semwal, christian.koenig
Cc: linux-arm-msm, dri-devel, linux-kernel, linux-media,
linaro-mm-sig, freedreno
On 09/01/2023 04:20, Jiasheng Jiang wrote:
> 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>
> ---
> Changelog:
>
> v1 -> v2:
>
> 1. Convert "goto err_destroy_workqueue" into "goto err_msm_unit" and
> remove "err_destroy_workqueue" label.
> ---
> drivers/gpu/drm/msm/msm_drv.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] drm/msm: Add missing check and destroy for alloc_ordered_workqueue
2023-01-09 2:20 [PATCH v2] drm/msm: Add missing check and destroy for alloc_ordered_workqueue Jiasheng Jiang
2023-01-18 1:24 ` Dmitry Baryshkov
@ 2023-01-18 2:06 ` Dmitry Baryshkov
1 sibling, 0 replies; 3+ messages in thread
From: Dmitry Baryshkov @ 2023-01-18 2:06 UTC (permalink / raw)
To: robdclark, quic_abhinavk, sean, airlied, sumit.semwal,
christian.koenig, Jiasheng Jiang
Cc: linux-arm-msm, dri-devel, linux-kernel, linux-media,
linaro-mm-sig, freedreno
On Mon, 09 Jan 2023 10:20:38 +0800, Jiasheng Jiang wrote:
> 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.
>
>
Applied, thanks!
[1/1] drm/msm: Add missing check and destroy for alloc_ordered_workqueue
https://gitlab.freedesktop.org/lumag/msm/-/commit/643b7d0869cc
Best regards,
--
Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-01-18 2:06 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-09 2:20 [PATCH v2] drm/msm: Add missing check and destroy for alloc_ordered_workqueue Jiasheng Jiang
2023-01-18 1:24 ` Dmitry Baryshkov
2023-01-18 2:06 ` Dmitry Baryshkov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).