[PATCH v2 5/8] drm/msm/a6xx: avoid shadow NULL reference in failure path

Akhil P Oommen akhilpo at codeaurora.org
Mon May 31 09:25:31 UTC 2021


On 5/13/2021 10:44 PM, Jonathan Marek wrote:
> If a6xx_hw_init() fails before creating the shadow_bo, the a6xx_pm_suspend
> code referencing it will crash. Change the condition to one that avoids
> this problem (note: creation of shadow_bo is behind this same condition)
> 
> Fixes: e8b0b994c3a5 ("drm/msm/a6xx: Clear shadow on suspend")
> Signed-off-by: Jonathan Marek <jonathan at marek.ca>
> ---
>   drivers/gpu/drm/msm/adreno/a6xx_gpu.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
> index 909e3ff08f89..ff3c328604f8 100644
> --- a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
> +++ b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
> @@ -1284,7 +1284,7 @@ static int a6xx_pm_suspend(struct msm_gpu *gpu)
>   	if (ret)
>   		return ret;
>   
> -	if (adreno_gpu->base.hw_apriv || a6xx_gpu->has_whereami)
> +	if (a6xx_gpu->shadow_bo)
>   		for (i = 0; i < gpu->nr_rings; i++)
>   			a6xx_gpu->shadow[i] = 0;
>   
> 
Reviewed-by: Akhil P Oommen <akhilpo at codeaurora.org>

-Akhil


More information about the dri-devel mailing list