diff mbox series

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

Message ID 20210513171431.18632-6-jonathan@marek.ca (mailing list archive)
State New, archived
Headers show
Series drm/msm/a6xx: add support for Adreno 660 GPU | expand

Commit Message

Jonathan Marek May 13, 2021, 5:14 p.m. UTC
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@marek.ca>
---
 drivers/gpu/drm/msm/adreno/a6xx_gpu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Akhil P Oommen May 31, 2021, 9:25 a.m. UTC | #1
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@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@codeaurora.org>

-Akhil
diff mbox series

Patch

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;