All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/atmel-hlcdc: remove unnecessary if statement
@ 2017-08-07  6:26 Stefan Agner
  2018-06-16 23:34   ` Stefan Agner
  0 siblings, 1 reply; 5+ messages in thread
From: Stefan Agner @ 2017-08-07  6:26 UTC (permalink / raw)
  To: boris.brezillon, airlied; +Cc: dri-devel, linux-kernel, Stefan Agner

The statement always evaluates to true since the struct fields
are arrays. This has shown up as a warning when compiling with
clang:
  warning: address of array 'desc->layout.xstride' will always
      evaluate to 'true' [-Wpointer-bool-conversion]

Signed-off-by: Stefan Agner <stefan@agner.ch>
---
 drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c | 21 +++++++++------------
 1 file changed, 9 insertions(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c
index 1124200bb280..9bd8c4888035 100644
--- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c
+++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c
@@ -854,24 +854,21 @@ static int atmel_hlcdc_plane_init_properties(struct atmel_hlcdc_plane *plane,
 				struct atmel_hlcdc_plane_properties *props)
 {
 	const struct atmel_hlcdc_layer_desc *desc = plane->layer.desc;
+	int ret;
 
 	if (desc->type == ATMEL_HLCDC_OVERLAY_LAYER ||
 	    desc->type == ATMEL_HLCDC_CURSOR_LAYER)
 		drm_object_attach_property(&plane->base.base,
 					   props->alpha, 255);
 
-	if (desc->layout.xstride && desc->layout.pstride) {
-		int ret;
-
-		ret = drm_plane_create_rotation_property(&plane->base,
-							 DRM_MODE_ROTATE_0,
-							 DRM_MODE_ROTATE_0 |
-							 DRM_MODE_ROTATE_90 |
-							 DRM_MODE_ROTATE_180 |
-							 DRM_MODE_ROTATE_270);
-		if (ret)
-			return ret;
-	}
+	ret = drm_plane_create_rotation_property(&plane->base,
+						 DRM_MODE_ROTATE_0,
+						 DRM_MODE_ROTATE_0 |
+						 DRM_MODE_ROTATE_90 |
+						 DRM_MODE_ROTATE_180 |
+						 DRM_MODE_ROTATE_270);
+	if (ret)
+		return ret;
 
 	if (desc->layout.csc) {
 		/*
-- 
2.13.3

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

* Re: [PATCH] drm/atmel-hlcdc: remove unnecessary if statement
  2017-08-07  6:26 [PATCH] drm/atmel-hlcdc: remove unnecessary if statement Stefan Agner
@ 2018-06-16 23:34   ` Stefan Agner
  0 siblings, 0 replies; 5+ messages in thread
From: Stefan Agner @ 2018-06-16 23:34 UTC (permalink / raw)
  To: boris.brezillon, maxime.ripard, airlied; +Cc: dri-devel, linux-kernel

Boris, Maxime,

On 07.08.2017 08:26, Stefan Agner wrote:
> The statement always evaluates to true since the struct fields
> are arrays. This has shown up as a warning when compiling with
> clang:
>   warning: address of array 'desc->layout.xstride' will always
>       evaluate to 'true' [-Wpointer-bool-conversion]

It seems that this patch never made it upstream. It still produces a
warning when building with clang. Maybe you could have a look and queue?

--
Stefan

> 
> Signed-off-by: Stefan Agner <stefan@agner.ch>
> ---
>  drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c | 21 +++++++++------------
>  1 file changed, 9 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c
> b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c
> index 1124200bb280..9bd8c4888035 100644
> --- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c
> +++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c
> @@ -854,24 +854,21 @@ static int
> atmel_hlcdc_plane_init_properties(struct atmel_hlcdc_plane *plane,
>  				struct atmel_hlcdc_plane_properties *props)
>  {
>  	const struct atmel_hlcdc_layer_desc *desc = plane->layer.desc;
> +	int ret;
>  
>  	if (desc->type == ATMEL_HLCDC_OVERLAY_LAYER ||
>  	    desc->type == ATMEL_HLCDC_CURSOR_LAYER)
>  		drm_object_attach_property(&plane->base.base,
>  					   props->alpha, 255);
>  
> -	if (desc->layout.xstride && desc->layout.pstride) {
> -		int ret;
> -
> -		ret = drm_plane_create_rotation_property(&plane->base,
> -							 DRM_MODE_ROTATE_0,
> -							 DRM_MODE_ROTATE_0 |
> -							 DRM_MODE_ROTATE_90 |
> -							 DRM_MODE_ROTATE_180 |
> -							 DRM_MODE_ROTATE_270);
> -		if (ret)
> -			return ret;
> -	}
> +	ret = drm_plane_create_rotation_property(&plane->base,
> +						 DRM_MODE_ROTATE_0,
> +						 DRM_MODE_ROTATE_0 |
> +						 DRM_MODE_ROTATE_90 |
> +						 DRM_MODE_ROTATE_180 |
> +						 DRM_MODE_ROTATE_270);
> +	if (ret)
> +		return ret;
>  
>  	if (desc->layout.csc) {
>  		/*

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

* Re: [PATCH] drm/atmel-hlcdc: remove unnecessary if statement
@ 2018-06-16 23:34   ` Stefan Agner
  0 siblings, 0 replies; 5+ messages in thread
From: Stefan Agner @ 2018-06-16 23:34 UTC (permalink / raw)
  To: boris.brezillon, maxime.ripard, airlied; +Cc: linux-kernel, dri-devel

Boris, Maxime,

On 07.08.2017 08:26, Stefan Agner wrote:
> The statement always evaluates to true since the struct fields
> are arrays. This has shown up as a warning when compiling with
> clang:
>   warning: address of array 'desc->layout.xstride' will always
>       evaluate to 'true' [-Wpointer-bool-conversion]

It seems that this patch never made it upstream. It still produces a
warning when building with clang. Maybe you could have a look and queue?

--
Stefan

> 
> Signed-off-by: Stefan Agner <stefan@agner.ch>
> ---
>  drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c | 21 +++++++++------------
>  1 file changed, 9 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c
> b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c
> index 1124200bb280..9bd8c4888035 100644
> --- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c
> +++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c
> @@ -854,24 +854,21 @@ static int
> atmel_hlcdc_plane_init_properties(struct atmel_hlcdc_plane *plane,
>  				struct atmel_hlcdc_plane_properties *props)
>  {
>  	const struct atmel_hlcdc_layer_desc *desc = plane->layer.desc;
> +	int ret;
>  
>  	if (desc->type == ATMEL_HLCDC_OVERLAY_LAYER ||
>  	    desc->type == ATMEL_HLCDC_CURSOR_LAYER)
>  		drm_object_attach_property(&plane->base.base,
>  					   props->alpha, 255);
>  
> -	if (desc->layout.xstride && desc->layout.pstride) {
> -		int ret;
> -
> -		ret = drm_plane_create_rotation_property(&plane->base,
> -							 DRM_MODE_ROTATE_0,
> -							 DRM_MODE_ROTATE_0 |
> -							 DRM_MODE_ROTATE_90 |
> -							 DRM_MODE_ROTATE_180 |
> -							 DRM_MODE_ROTATE_270);
> -		if (ret)
> -			return ret;
> -	}
> +	ret = drm_plane_create_rotation_property(&plane->base,
> +						 DRM_MODE_ROTATE_0,
> +						 DRM_MODE_ROTATE_0 |
> +						 DRM_MODE_ROTATE_90 |
> +						 DRM_MODE_ROTATE_180 |
> +						 DRM_MODE_ROTATE_270);
> +	if (ret)
> +		return ret;
>  
>  	if (desc->layout.csc) {
>  		/*
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH] drm/atmel-hlcdc: remove unnecessary if statement
  2018-06-16 23:34   ` Stefan Agner
@ 2018-06-17  7:50     ` Boris Brezillon
  -1 siblings, 0 replies; 5+ messages in thread
From: Boris Brezillon @ 2018-06-17  7:50 UTC (permalink / raw)
  To: Stefan Agner; +Cc: maxime.ripard, airlied, dri-devel, linux-kernel

On Sun, 17 Jun 2018 01:34:34 +0200
Stefan Agner <stefan@agner.ch> wrote:

> Boris, Maxime,
> 
> On 07.08.2017 08:26, Stefan Agner wrote:
> > The statement always evaluates to true since the struct fields
> > are arrays. This has shown up as a warning when compiling with
> > clang:
> >   warning: address of array 'desc->layout.xstride' will always
> >       evaluate to 'true' [-Wpointer-bool-conversion]  
> 
> It seems that this patch never made it upstream. It still produces a
> warning when building with clang. Maybe you could have a look and queue?

Oops, sorry, I missed that one.

> 
> --
> Stefan
> 
> > 
> > Signed-off-by: Stefan Agner <stefan@agner.ch>
> > ---
> >  drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c | 21 +++++++++------------
> >  1 file changed, 9 insertions(+), 12 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c
> > b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c
> > index 1124200bb280..9bd8c4888035 100644
> > --- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c
> > +++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c
> > @@ -854,24 +854,21 @@ static int
> > atmel_hlcdc_plane_init_properties(struct atmel_hlcdc_plane *plane,
> >  				struct atmel_hlcdc_plane_properties *props)
> >  {
> >  	const struct atmel_hlcdc_layer_desc *desc = plane->layer.desc;
> > +	int ret;
> >  
> >  	if (desc->type == ATMEL_HLCDC_OVERLAY_LAYER ||
> >  	    desc->type == ATMEL_HLCDC_CURSOR_LAYER)
> >  		drm_object_attach_property(&plane->base.base,
> >  					   props->alpha, 255);
> >  
> > -	if (desc->layout.xstride && desc->layout.pstride) {

The test should be 

	if (desc->layout.xstride[0] && desc->layout.pstride[0])

Can you send a new version with this change?

> > -		int ret;
> > -
> > -		ret = drm_plane_create_rotation_property(&plane->base,
> > -							 DRM_MODE_ROTATE_0,
> > -							 DRM_MODE_ROTATE_0 |
> > -							 DRM_MODE_ROTATE_90 |
> > -							 DRM_MODE_ROTATE_180 |
> > -							 DRM_MODE_ROTATE_270);
> > -		if (ret)
> > -			return ret;
> > -	}
> > +	ret = drm_plane_create_rotation_property(&plane->base,
> > +						 DRM_MODE_ROTATE_0,
> > +						 DRM_MODE_ROTATE_0 |
> > +						 DRM_MODE_ROTATE_90 |
> > +						 DRM_MODE_ROTATE_180 |
> > +						 DRM_MODE_ROTATE_270);
> > +	if (ret)
> > +		return ret;
> >  
> >  	if (desc->layout.csc) {
> >  		/*  


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

* Re: [PATCH] drm/atmel-hlcdc: remove unnecessary if statement
@ 2018-06-17  7:50     ` Boris Brezillon
  0 siblings, 0 replies; 5+ messages in thread
From: Boris Brezillon @ 2018-06-17  7:50 UTC (permalink / raw)
  To: Stefan Agner; +Cc: maxime.ripard, airlied, linux-kernel, dri-devel

On Sun, 17 Jun 2018 01:34:34 +0200
Stefan Agner <stefan@agner.ch> wrote:

> Boris, Maxime,
> 
> On 07.08.2017 08:26, Stefan Agner wrote:
> > The statement always evaluates to true since the struct fields
> > are arrays. This has shown up as a warning when compiling with
> > clang:
> >   warning: address of array 'desc->layout.xstride' will always
> >       evaluate to 'true' [-Wpointer-bool-conversion]  
> 
> It seems that this patch never made it upstream. It still produces a
> warning when building with clang. Maybe you could have a look and queue?

Oops, sorry, I missed that one.

> 
> --
> Stefan
> 
> > 
> > Signed-off-by: Stefan Agner <stefan@agner.ch>
> > ---
> >  drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c | 21 +++++++++------------
> >  1 file changed, 9 insertions(+), 12 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c
> > b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c
> > index 1124200bb280..9bd8c4888035 100644
> > --- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c
> > +++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c
> > @@ -854,24 +854,21 @@ static int
> > atmel_hlcdc_plane_init_properties(struct atmel_hlcdc_plane *plane,
> >  				struct atmel_hlcdc_plane_properties *props)
> >  {
> >  	const struct atmel_hlcdc_layer_desc *desc = plane->layer.desc;
> > +	int ret;
> >  
> >  	if (desc->type == ATMEL_HLCDC_OVERLAY_LAYER ||
> >  	    desc->type == ATMEL_HLCDC_CURSOR_LAYER)
> >  		drm_object_attach_property(&plane->base.base,
> >  					   props->alpha, 255);
> >  
> > -	if (desc->layout.xstride && desc->layout.pstride) {

The test should be 

	if (desc->layout.xstride[0] && desc->layout.pstride[0])

Can you send a new version with this change?

> > -		int ret;
> > -
> > -		ret = drm_plane_create_rotation_property(&plane->base,
> > -							 DRM_MODE_ROTATE_0,
> > -							 DRM_MODE_ROTATE_0 |
> > -							 DRM_MODE_ROTATE_90 |
> > -							 DRM_MODE_ROTATE_180 |
> > -							 DRM_MODE_ROTATE_270);
> > -		if (ret)
> > -			return ret;
> > -	}
> > +	ret = drm_plane_create_rotation_property(&plane->base,
> > +						 DRM_MODE_ROTATE_0,
> > +						 DRM_MODE_ROTATE_0 |
> > +						 DRM_MODE_ROTATE_90 |
> > +						 DRM_MODE_ROTATE_180 |
> > +						 DRM_MODE_ROTATE_270);
> > +	if (ret)
> > +		return ret;
> >  
> >  	if (desc->layout.csc) {
> >  		/*  

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

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

end of thread, other threads:[~2018-06-17  7:50 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-07  6:26 [PATCH] drm/atmel-hlcdc: remove unnecessary if statement Stefan Agner
2018-06-16 23:34 ` Stefan Agner
2018-06-16 23:34   ` Stefan Agner
2018-06-17  7:50   ` Boris Brezillon
2018-06-17  7:50     ` Boris Brezillon

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.