Skip to contentSkip to conversation

drm/msm/mdp5: remove less than 0 comparison for unsigned value

PATCH In review Aishwarya Pant 2 participants 2 messages Oct 10, 2017 – Oct 11, 2017

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

PATCH 1/1 drm/msm/mdp5: remove less than 0 comparison for unsigned value

pipe is an unsigned int and less than zero comparison for unsigned values is always false.

Detected using the following cocci script:

@@
unsigned int i;
@@
* i < 0

---
 drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c +1 -1
index f7c0698fec40..7e829a8d1cb1 100644
@@ -599,7 +599,7 @@ static u32 mdp5_get_vblank_counter(struct drm_device *dev, unsigned int pipe)
 	struct drm_crtc *crtc;
 	struct drm_encoder *encoder;
 
-	if (pipe < 0 || pipe >= priv->num_crtcs)
+	if (pipe >= priv->num_crtcs)
 		return 0;
 
 	crtc = priv->crtcs[pipe];
Signature · 1 line
2.11.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 10 lines · Aishwarya Pant

pipe is an unsigned int and less than zero comparison for unsigned values is always false.

Detected using the following cocci script:

@@
unsigned int i;
@@
* i < 0

Thanks

Quoted 19 lines
---
 drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c +1 -2
index f7c0698fec40..7e829a8d1cb1 100644
@@ -599,7 +599,7 @@ static u32 mdp5_get_vblank_counter(struct drm_device *dev, unsigned int pipe)
        struct drm_crtc *crtc;
        struct drm_encoder *encoder;
 
-       if (pipe < 0 || pipe >= priv->num_crtcs)
+       if (pipe >= priv->num_crtcs)
                return 0;
 
        crtc = priv->crtcs[pipe];
--
Quoted 2 lines

2.11.0

_______________________________________________
Freedreno mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/freedreno