diff mbox series

[V2] drm/msm/a5xx: remove null pointer check on pdev

Message ID 20241112182218.1119158-1-colin.i.king@gmail.com (mailing list archive)
State Not Applicable
Headers show
Series [V2] drm/msm/a5xx: remove null pointer check on pdev | expand

Commit Message

Colin Ian King Nov. 12, 2024, 6:22 p.m. UTC
The call chain on a5xx_gpu_init is such that pdev is not going to be
null, so the null check on pdev can be removed. This also cleans up
a static analysis warning where pdev is dereferenced before the null
check which cannot actually occur.

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>

---

V2: rewrite Subject, remove null check on pdev

---
 drivers/gpu/drm/msm/adreno/a5xx_gpu.c | 5 -----
 1 file changed, 5 deletions(-)

Comments

Akhil P Oommen Nov. 12, 2024, 8:30 p.m. UTC | #1
On 11/12/2024 11:52 PM, Colin Ian King wrote:
> The call chain on a5xx_gpu_init is such that pdev is not going to be
> null, so the null check on pdev can be removed. This also cleans up
> a static analysis warning where pdev is dereferenced before the null
> check which cannot actually occur.
> 
> Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
> 
Reviewed-by: Akhil P Oommen <quic_akhilpo@quicinc.com>

-Akhil
> ---
> 
> V2: rewrite Subject, remove null check on pdev
> 
> ---
>  drivers/gpu/drm/msm/adreno/a5xx_gpu.c | 5 -----
>  1 file changed, 5 deletions(-)
> 
> diff --git a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
> index ee89db72e36e..4edf9109d1d8 100644
> --- a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
> +++ b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
> @@ -1760,11 +1760,6 @@ struct msm_gpu *a5xx_gpu_init(struct drm_device *dev)
>  	unsigned int nr_rings;
>  	int ret;
>  
> -	if (!pdev) {
> -		DRM_DEV_ERROR(dev->dev, "No A5XX device is defined\n");
> -		return ERR_PTR(-ENXIO);
> -	}
> -
>  	a5xx_gpu = kzalloc(sizeof(*a5xx_gpu), GFP_KERNEL);
>  	if (!a5xx_gpu)
>  		return ERR_PTR(-ENOMEM);
Konrad Dybcio Nov. 14, 2024, 1:57 p.m. UTC | #2
On 12.11.2024 7:22 PM, Colin Ian King wrote:
> The call chain on a5xx_gpu_init is such that pdev is not going to be
> null, so the null check on pdev can be removed. This also cleans up
> a static analysis warning where pdev is dereferenced before the null
> check which cannot actually occur.
> 
> Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
> 
> ---

Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>

Konrad
diff mbox series

Patch

diff --git a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
index ee89db72e36e..4edf9109d1d8 100644
--- a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
+++ b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
@@ -1760,11 +1760,6 @@  struct msm_gpu *a5xx_gpu_init(struct drm_device *dev)
 	unsigned int nr_rings;
 	int ret;
 
-	if (!pdev) {
-		DRM_DEV_ERROR(dev->dev, "No A5XX device is defined\n");
-		return ERR_PTR(-ENXIO);
-	}
-
 	a5xx_gpu = kzalloc(sizeof(*a5xx_gpu), GFP_KERNEL);
 	if (!a5xx_gpu)
 		return ERR_PTR(-ENOMEM);