dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* linux-4.7-rc3/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c: 2 * pointless tests ?
@ 2016-06-13 14:51 David Binderman
  2016-06-13 15:27 ` Rob Clark
  0 siblings, 1 reply; 6+ messages in thread
From: David Binderman @ 2016-06-13 14:51 UTC (permalink / raw)
  To: robdclark, airlied, linux-arm-msm, dri-devel, freedreno,
	linux-kernel, dcb314

Hello there,

1.

linux-4.7-rc3/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c:545]: (style)
Checking if unsigned variable 'pipe' is less than zero.

Source code is

    if (pipe < 0 || pipe >= priv->num_crtcs) {

2.

linux-4.7-rc3/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c:567]: (style)
Checking if unsigned variable 'pipe' is less than zero.

Duplicate a few lines further down.


Regards

David Binderman

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: linux-4.7-rc3/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c: 2 * pointless tests ?
  2016-06-13 14:51 linux-4.7-rc3/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c: 2 * pointless tests ? David Binderman
@ 2016-06-13 15:27 ` Rob Clark
       [not found]   ` <CAF6AEGtvE1bseBiKwyoQDwRZS_dks4EsVYE_k7naA77p9410mQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  2016-06-29 12:51   ` [PATCH] drm/msm/mdp5: Remove "pipe < 0" check Vedran Miletić
  0 siblings, 2 replies; 6+ messages in thread
From: Rob Clark @ 2016-06-13 15:27 UTC (permalink / raw)
  To: David Binderman
  Cc: David Airlie, linux-arm-msm, dri-devel@lists.freedesktop.org,
	freedreno, Linux Kernel Mailing List, dcb314

yup, looks like we can drop the two pipe<0 checks.  Care to send a patch?

BR,
-R

On Mon, Jun 13, 2016 at 10:51 AM, David Binderman
<linuxdev.baldrick@gmail.com> wrote:
> Hello there,
>
> 1.
>
> linux-4.7-rc3/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c:545]: (style)
> Checking if unsigned variable 'pipe' is less than zero.
>
> Source code is
>
>     if (pipe < 0 || pipe >= priv->num_crtcs) {
>
> 2.
>
> linux-4.7-rc3/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c:567]: (style)
> Checking if unsigned variable 'pipe' is less than zero.
>
> Duplicate a few lines further down.
>
>
> Regards
>
> David Binderman

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: linux-4.7-rc3/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c: 2 * pointless tests ?
       [not found]   ` <CAF6AEGtvE1bseBiKwyoQDwRZS_dks4EsVYE_k7naA77p9410mQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2016-06-15 10:03     ` David Binderman
  0 siblings, 0 replies; 6+ messages in thread
From: David Binderman @ 2016-06-15 10:03 UTC (permalink / raw)
  To: Rob Clark
  Cc: David Airlie, linux-arm-msm, Linux Kernel Mailing List,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
	dcb314-PkbjNfxxIARBDgjK7y7TUQ,
	freedreno-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

Hello there,

>yup, looks like we can drop the two pipe<0 checks.

Righto.

>Care to send a patch?

Oh dear. My success rate with patches is near zero. Maybe something
like this might be suitable:

*** linux-3.7-rc3/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c.sav
2016-06-15 10:58:04.868619030 +0100
--- linux-4.7-rc3/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c   2016-06-15
10:58:25.401942157 +0100
***************
*** 542,548 ****
    struct msm_drm_private *priv = dev->dev_private;
    struct drm_crtc *crtc;

!   if (pipe < 0 || pipe >= priv->num_crtcs) {
        DRM_ERROR("Invalid crtc %d\n", pipe);
        return -EINVAL;
    }
--- 542,548 ----
    struct msm_drm_private *priv = dev->dev_private;
    struct drm_crtc *crtc;

!   if (pipe >= priv->num_crtcs) {
        DRM_ERROR("Invalid crtc %d\n", pipe);
        return -EINVAL;
    }
***************
*** 564,570 ****
    struct drm_crtc *crtc;
    struct drm_encoder *encoder;

!   if (pipe < 0 || pipe >= priv->num_crtcs)
        return 0;

    crtc = priv->crtcs[pipe];
--- 564,570 ----
    struct drm_crtc *crtc;
    struct drm_encoder *encoder;

!   if (pipe >= priv->num_crtcs)
        return 0;

    crtc = priv->crtcs[pipe];

Feel free to mess this tentative patch about in any way you see fit.


Regards

David Binderman


On Mon, Jun 13, 2016 at 4:27 PM, Rob Clark <robdclark@gmail.com> wrote:
> yup, looks like we can drop the two pipe<0 checks.  Care to send a patch?
>
> BR,
> -R
>
> On Mon, Jun 13, 2016 at 10:51 AM, David Binderman
> <linuxdev.baldrick@gmail.com> wrote:
>> Hello there,
>>
>> 1.
>>
>> linux-4.7-rc3/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c:545]: (style)
>> Checking if unsigned variable 'pipe' is less than zero.
>>
>> Source code is
>>
>>     if (pipe < 0 || pipe >= priv->num_crtcs) {
>>
>> 2.
>>
>> linux-4.7-rc3/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c:567]: (style)
>> Checking if unsigned variable 'pipe' is less than zero.
>>
>> Duplicate a few lines further down.
>>
>>
>> Regards
>>
>> David Binderman
_______________________________________________
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH] drm/msm/mdp5: Remove "pipe < 0" check
  2016-06-13 15:27 ` Rob Clark
       [not found]   ` <CAF6AEGtvE1bseBiKwyoQDwRZS_dks4EsVYE_k7naA77p9410mQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2016-06-29 12:51   ` Vedran Miletić
  2016-06-29 12:51     ` Vedran Miletić
  1 sibling, 1 reply; 6+ messages in thread
From: Vedran Miletić @ 2016-06-29 12:51 UTC (permalink / raw)
  To: dri-devel; +Cc: linuxdev.baldrick, dcb314

From: David Binderman <linuxdev.baldrick@gmail.com>

For usingned int pipe, pipe < 0 is always true.
---
 drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c
index 484b4d1..352b7ad 100644
--- a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c
+++ b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c
@@ -542,7 +542,7 @@ static int mdp5_get_vblank_timestamp(struct drm_device *dev, unsigned int pipe,
 	struct msm_drm_private *priv = dev->dev_private;
 	struct drm_crtc *crtc;
 
-	if (pipe < 0 || pipe >= priv->num_crtcs) {
+	if (pipe >= priv->num_crtcs) {
 		DRM_ERROR("Invalid crtc %d\n", pipe);
 		return -EINVAL;
 	}
@@ -564,7 +564,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];
-- 
2.8.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH] drm/msm/mdp5: Remove "pipe < 0" check
  2016-06-29 12:51   ` [PATCH] drm/msm/mdp5: Remove "pipe < 0" check Vedran Miletić
@ 2016-06-29 12:51     ` Vedran Miletić
  2016-07-12 10:24       ` Daniel Vetter
  0 siblings, 1 reply; 6+ messages in thread
From: Vedran Miletić @ 2016-06-29 12:51 UTC (permalink / raw)
  To: dri-devel; +Cc: linuxdev.baldrick, dcb314

From: David Binderman <linuxdev.baldrick@gmail.com>

For usingned int pipe, pipe < 0 is always true.
---
 drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c
index 484b4d1..352b7ad 100644
--- a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c
+++ b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c
@@ -542,7 +542,7 @@ static int mdp5_get_vblank_timestamp(struct drm_device *dev, unsigned int pipe,
 	struct msm_drm_private *priv = dev->dev_private;
 	struct drm_crtc *crtc;
 
-	if (pipe < 0 || pipe >= priv->num_crtcs) {
+	if (pipe >= priv->num_crtcs) {
 		DRM_ERROR("Invalid crtc %d\n", pipe);
 		return -EINVAL;
 	}
@@ -564,7 +564,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];
-- 
2.8.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] drm/msm/mdp5: Remove "pipe < 0" check
  2016-06-29 12:51     ` Vedran Miletić
@ 2016-07-12 10:24       ` Daniel Vetter
  0 siblings, 0 replies; 6+ messages in thread
From: Daniel Vetter @ 2016-07-12 10:24 UTC (permalink / raw)
  To: Vedran Miletić; +Cc: linuxdev.baldrick, dcb314, dri-devel

On Wed, Jun 29, 2016 at 02:51:10PM +0200, Vedran Miletić wrote:
> From: David Binderman <linuxdev.baldrick@gmail.com>
> 
> For usingned int pipe, pipe < 0 is always true.

Your patch needs a signed-off-by line, see Documenation/SubmittingPatches.
-Daniel

> ---
>  drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c
> index 484b4d1..352b7ad 100644
> --- a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c
> +++ b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c
> @@ -542,7 +542,7 @@ static int mdp5_get_vblank_timestamp(struct drm_device *dev, unsigned int pipe,
>  	struct msm_drm_private *priv = dev->dev_private;
>  	struct drm_crtc *crtc;
>  
> -	if (pipe < 0 || pipe >= priv->num_crtcs) {
> +	if (pipe >= priv->num_crtcs) {
>  		DRM_ERROR("Invalid crtc %d\n", pipe);
>  		return -EINVAL;
>  	}
> @@ -564,7 +564,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];
> -- 
> 2.8.1
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-07-12 10:25 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-13 14:51 linux-4.7-rc3/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c: 2 * pointless tests ? David Binderman
2016-06-13 15:27 ` Rob Clark
     [not found]   ` <CAF6AEGtvE1bseBiKwyoQDwRZS_dks4EsVYE_k7naA77p9410mQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-06-15 10:03     ` David Binderman
2016-06-29 12:51   ` [PATCH] drm/msm/mdp5: Remove "pipe < 0" check Vedran Miletić
2016-06-29 12:51     ` Vedran Miletić
2016-07-12 10:24       ` Daniel Vetter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox