Skip to contentSkip to conversation

drm/msm: remove unnecessary NULL check

PATCH Applied Dan Carpenter 4 participants 7 messages Oct 13, 2023 – Nov 21, 2023

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 drm/msm: remove unnecessary NULL check

This NULL check was required when it was added, but we shuffled the code around and now it's not. The inconsistent NULL checking triggers a Smatch warning:

drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c:847 mdp5_init() warn:
variable dereferenced before check 'mdp5_kms' (see line 782)

Fixes 1f50db2f3e1e ("drm/msm/mdp5: move resource allocation to the _probe function"

---
v2: Added a Fixes tag. It's not really a bug fix and so adding the fixes tag is slightly unfair but it should prevent this patch from accidentally getting backported before the refactoring and causing an issue.

Btw, fixes tags are often unfair like this. People look at fixes tags and think, "the fix introduced a bug" but actually it's really common that the fix was just not complete. But from a backporting perspective it makes sense to tie them together.

Plus everyone introduces bugs. If you're not introducing bugs, then you're probably not writing a lot of code.

 drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c +1 -2
index 11d9fc2c6bf5..ec933d597e20 100644
@@ -844,8 +844,7 @@ static int mdp5_init(struct platform_device *pdev, struct drm_device *dev)
 
 	return 0;
 fail:
-	if (mdp5_kms)
-		mdp5_destroy(mdp5_kms);
+	mdp5_destroy(mdp5_kms);
 	return ret;
 }
 
Signature · 1 line
2.39.2
Reviewed-by on v2 1/1
#1 lore raw
Quoted 9 lines · Dan Carpenter

This NULL check was required when it was added, but we shuffled the code around and now it's not. The inconsistent NULL checking triggers a Smatch warning:

drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c:847 mdp5_init() warn:
variable dereferenced before check 'mdp5_kms' (see line 782)

Fixes 1f50db2f3e1e ("drm/msm/mdp5: move resource allocation to the _probe function"

(already provided for (implicit) v1, but wasn't picked up)

Thanks
Uwe

Signature · 2 lines
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |
Reviewed-by on v2 1/1
#2 lore raw
In reply to Dan Carpenter
Quoted 20 lines · Dan Carpenter

This NULL check was required when it was added, but we shuffled the code around and now it's not. The inconsistent NULL checking triggers a Smatch warning:

drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c:847 mdp5_init() warn:
variable dereferenced before check 'mdp5_kms' (see line 782)

Fixes 1f50db2f3e1e ("drm/msm/mdp5: move resource allocation to the _probe function"

---
v2: Added a Fixes tag. It's not really a bug fix and so adding the fixes tag is slightly unfair but it should prevent this patch from accidentally getting backported before the refactoring and causing an issue.

Btw, fixes tags are often unfair like this. People look at fixes tags and think, "the fix introduced a bug" but actually it's really common that the fix was just not complete. But from a backporting perspective it makes sense to tie them together.

Quoted 5 lines

Plus everyone introduces bugs. If you're not introducing bugs, then you're probably not writing a lot of code.

  drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c | 3 +--
  1 file changed, 1 insertion(+), 2 deletions(-)
Signature · 2 lines
With best wishes
Dmitry
Reviewed-by on v2 1/1
#3 lore raw
In reply to Dan Carpenter
Quoted 20 lines · Dan Carpenter

This NULL check was required when it was added, but we shuffled the code around and now it's not. The inconsistent NULL checking triggers a Smatch warning:

drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c:847 mdp5_init() warn:
variable dereferenced before check 'mdp5_kms' (see line 782)

Fixes 1f50db2f3e1e ("drm/msm/mdp5: move resource allocation to the _probe function"

---
v2: Added a Fixes tag. It's not really a bug fix and so adding the fixes tag is slightly unfair but it should prevent this patch from accidentally getting backported before the refactoring and causing an issue.

Btw, fixes tags are often unfair like this. People look at fixes tags and think, "the fix introduced a bug" but actually it's really common that the fix was just not complete. But from a backporting perspective it makes sense to tie them together.

Quoted 6 lines

Plus everyone introduces bugs. If you're not introducing bugs, then you're probably not writing a lot of code.

  drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c | 3 +--
  1 file changed, 1 insertion(+), 2 deletions(-)

LGTM,

#4 lore raw
Quoted 11 lines · Abhinav Kumar
Quoted 8 lines · Dan Carpenter

This NULL check was required when it was added, but we shuffled the code around and now it's not.  The inconsistent NULL checking triggers a Smatch warning:

     drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c:847 mdp5_init() warn:
     variable dereferenced before check 'mdp5_kms' (see line 782)

Fixes 1f50db2f3e1e ("drm/msm/mdp5: move resource allocation to the _probe function"

A small error here. Its missing the closing brace for the Fixes tag. Checkpatch cries without it.

I have fixed it while applying.

Quoted 23 lines
Quoted 12 lines

---
v2: Added a Fixes tag.  It's not really a bug fix and so adding the fixes tag is slightly unfair but it should prevent this patch from accidentally getting backported before the refactoring and causing an issue.

Btw, fixes tags are often unfair like this.  People look at fixes tags and think, "the fix introduced a bug" but actually it's really common that the fix was just not complete.  But from a backporting perspective it makes sense to tie them together.

Quoted 6 lines

Plus everyone introduces bugs.  If you're not introducing bugs, then you're probably not writing a lot of code.

  drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c | 3 +--

  1 file changed, 1 insertion(+), 2 deletions(-)

LGTM,

#5 lore raw
Quoted 10 lines · Abhinav Kumar
Quoted 7 lines · Abhinav Kumar
Quoted 4 lines · Dan Carpenter

This NULL check was required when it was added, but we shuffled the code around and now it's not.? The inconsistent NULL checking triggers a Smatch warning:

Quoted 9 lines
Quoted 5 lines
Quoted 5 lines

???? drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c:847 mdp5_init() warn:
???? variable dereferenced before check 'mdp5_kms' (see line 782)

Fixes 1f50db2f3e1e ("drm/msm/mdp5: move resource allocation to the

_probe function"

A small error here. Its missing the closing brace for the Fixes tag. Checkpatch cries without it.

Sorry. I must have accidentally deleted it after I ran checkpatch.

Quoted 1 line

I have fixed it while applying.

Thanks!

regards,
dan carpenter

#6 lore raw
In reply to Dan Carpenter
Quoted 8 lines · Dan Carpenter

This NULL check was required when it was added, but we shuffled the code around and now it's not. The inconsistent NULL checking triggers a Smatch warning:

drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c:847 mdp5_init() warn:
variable dereferenced before check 'mdp5_kms' (see line 782)

[...]

Applied, thanks!

[1/1] drm/msm: remove unnecessary NULL check

      https://gitlab.freedesktop.org/drm/msm/-/commit/56466f653cb5

Best regards,

Signature · 1 line
Abhinav Kumar <[email protected]>