[PATCH v6 1/4] drm/msm: clean event_thread->worker in case of an error

Abhinav Kumar quic_abhinavk at quicinc.com
Thu Sep 8 00:08:24 UTC 2022



On 6/17/2022 4:33 PM, Dmitry Baryshkov wrote:
> If worker creation fails, nullify the event_thread->worker, so that
> msm_drm_uninit() doesn't try accessing invalid memory location. While we
> are at it, remove duplicate assignment to the ret variable.
> 
> Fixes: 1041dee2178f ("drm/msm: use kthread_create_worker instead of kthread_run")
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov at linaro.org>

the change itself LGTM,

Reviewed-by: Abhinav Kumar <quic_abhinavk at quicinc.com>

One minor nit below
> ---
>   drivers/gpu/drm/msm/msm_drv.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c
> index 44485363f37a..1aab6bf86278 100644
> --- a/drivers/gpu/drm/msm/msm_drv.c
> +++ b/drivers/gpu/drm/msm/msm_drv.c
> @@ -436,7 +436,7 @@ static int msm_drm_init(struct device *dev, const struct drm_driver *drv)
>   		if (IS_ERR(priv->event_thread[i].worker)) {
>   			ret = PTR_ERR(priv->event_thread[i].worker);
>   			DRM_DEV_ERROR(dev, "failed to create crtc_event kthread\n");

Can we print ret in this error message?

> -			ret = PTR_ERR(priv->event_thread[i].worker);
> +			priv->event_thread[i].worker = NULL;
>   			goto err_msm_uninit;
>   		}
>   


More information about the dri-devel mailing list