All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/ingenic: Silence uninitialized-variable warning
@ 2020-07-19  9:38 ` Paul Cercueil
  0 siblings, 0 replies; 6+ messages in thread
From: Paul Cercueil @ 2020-07-19  9:38 UTC (permalink / raw)
  To: David Airlie, Daniel Vetter, Sam Ravnborg
  Cc: od, dri-devel, linux-kernel, Paul Cercueil

Silence compiler warning about used but uninitialized 'ipu_state'
variable. In practice, the variable would never be used when
uninitialized, but the compiler cannot know that 'priv->ipu_plane' will
always be NULL if CONFIG_INGENIC_IPU is disabled.

Silence the warning by initializing the value to NULL.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
---
 drivers/gpu/drm/ingenic/ingenic-drm-drv.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
index b6d946fbeaf5..ada990a7f911 100644
--- a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
+++ b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
@@ -198,7 +198,7 @@ static int ingenic_drm_crtc_atomic_check(struct drm_crtc *crtc,
 					 struct drm_crtc_state *state)
 {
 	struct ingenic_drm *priv = drm_crtc_get_priv(crtc);
-	struct drm_plane_state *f1_state, *f0_state, *ipu_state;
+	struct drm_plane_state *f1_state, *f0_state, *ipu_state = NULL;
 	long rate;
 
 	if (!drm_atomic_crtc_needs_modeset(state))
@@ -229,7 +229,7 @@ static int ingenic_drm_crtc_atomic_check(struct drm_crtc *crtc,
 
 		/* If all the planes are disabled, we won't get a VBLANK IRQ */
 		priv->no_vblank = !f1_state->fb && !f0_state->fb &&
-				  !(priv->ipu_plane && ipu_state->fb);
+				  !(ipu_state && ipu_state->fb);
 	}
 
 	return 0;
-- 
2.27.0


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

* [PATCH] drm/ingenic: Silence uninitialized-variable warning
@ 2020-07-19  9:38 ` Paul Cercueil
  0 siblings, 0 replies; 6+ messages in thread
From: Paul Cercueil @ 2020-07-19  9:38 UTC (permalink / raw)
  To: David Airlie, Daniel Vetter, Sam Ravnborg
  Cc: Paul Cercueil, od, linux-kernel, dri-devel

Silence compiler warning about used but uninitialized 'ipu_state'
variable. In practice, the variable would never be used when
uninitialized, but the compiler cannot know that 'priv->ipu_plane' will
always be NULL if CONFIG_INGENIC_IPU is disabled.

Silence the warning by initializing the value to NULL.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
---
 drivers/gpu/drm/ingenic/ingenic-drm-drv.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
index b6d946fbeaf5..ada990a7f911 100644
--- a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
+++ b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
@@ -198,7 +198,7 @@ static int ingenic_drm_crtc_atomic_check(struct drm_crtc *crtc,
 					 struct drm_crtc_state *state)
 {
 	struct ingenic_drm *priv = drm_crtc_get_priv(crtc);
-	struct drm_plane_state *f1_state, *f0_state, *ipu_state;
+	struct drm_plane_state *f1_state, *f0_state, *ipu_state = NULL;
 	long rate;
 
 	if (!drm_atomic_crtc_needs_modeset(state))
@@ -229,7 +229,7 @@ static int ingenic_drm_crtc_atomic_check(struct drm_crtc *crtc,
 
 		/* If all the planes are disabled, we won't get a VBLANK IRQ */
 		priv->no_vblank = !f1_state->fb && !f0_state->fb &&
-				  !(priv->ipu_plane && ipu_state->fb);
+				  !(ipu_state && ipu_state->fb);
 	}
 
 	return 0;
-- 
2.27.0

_______________________________________________
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/ingenic: Silence uninitialized-variable warning
  2020-07-19  9:38 ` Paul Cercueil
@ 2020-07-19 10:23   ` Sam Ravnborg
  -1 siblings, 0 replies; 6+ messages in thread
From: Sam Ravnborg @ 2020-07-19 10:23 UTC (permalink / raw)
  To: Paul Cercueil; +Cc: David Airlie, Daniel Vetter, od, dri-devel, linux-kernel

Hi Paul.

On Sun, Jul 19, 2020 at 11:38:34AM +0200, Paul Cercueil wrote:
> Silence compiler warning about used but uninitialized 'ipu_state'
> variable. In practice, the variable would never be used when
> uninitialized, but the compiler cannot know that 'priv->ipu_plane' will
> always be NULL if CONFIG_INGENIC_IPU is disabled.
> 
> Silence the warning by initializing the value to NULL.
> 
> Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Patch looks good. Had to dig into the code to understand the
change to the no_vblank flag.
So:
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>

I expect you to commit the patch.

Looking at the code I noticed that the return value of
drm_atomic_get_plane_state() is not checked.
Can you try to look into this.

	Sam

> ---
>  drivers/gpu/drm/ingenic/ingenic-drm-drv.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
> index b6d946fbeaf5..ada990a7f911 100644
> --- a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
> +++ b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
> @@ -198,7 +198,7 @@ static int ingenic_drm_crtc_atomic_check(struct drm_crtc *crtc,
>  					 struct drm_crtc_state *state)
>  {
>  	struct ingenic_drm *priv = drm_crtc_get_priv(crtc);
> -	struct drm_plane_state *f1_state, *f0_state, *ipu_state;
> +	struct drm_plane_state *f1_state, *f0_state, *ipu_state = NULL;
>  	long rate;
>  
>  	if (!drm_atomic_crtc_needs_modeset(state))
> @@ -229,7 +229,7 @@ static int ingenic_drm_crtc_atomic_check(struct drm_crtc *crtc,
>  
>  		/* If all the planes are disabled, we won't get a VBLANK IRQ */
>  		priv->no_vblank = !f1_state->fb && !f0_state->fb &&
> -				  !(priv->ipu_plane && ipu_state->fb);
> +				  !(ipu_state && ipu_state->fb);
>  	}
>  
>  	return 0;
> -- 
> 2.27.0

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

* Re: [PATCH] drm/ingenic: Silence uninitialized-variable warning
@ 2020-07-19 10:23   ` Sam Ravnborg
  0 siblings, 0 replies; 6+ messages in thread
From: Sam Ravnborg @ 2020-07-19 10:23 UTC (permalink / raw)
  To: Paul Cercueil; +Cc: David Airlie, od, dri-devel, linux-kernel

Hi Paul.

On Sun, Jul 19, 2020 at 11:38:34AM +0200, Paul Cercueil wrote:
> Silence compiler warning about used but uninitialized 'ipu_state'
> variable. In practice, the variable would never be used when
> uninitialized, but the compiler cannot know that 'priv->ipu_plane' will
> always be NULL if CONFIG_INGENIC_IPU is disabled.
> 
> Silence the warning by initializing the value to NULL.
> 
> Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Patch looks good. Had to dig into the code to understand the
change to the no_vblank flag.
So:
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>

I expect you to commit the patch.

Looking at the code I noticed that the return value of
drm_atomic_get_plane_state() is not checked.
Can you try to look into this.

	Sam

> ---
>  drivers/gpu/drm/ingenic/ingenic-drm-drv.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
> index b6d946fbeaf5..ada990a7f911 100644
> --- a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
> +++ b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
> @@ -198,7 +198,7 @@ static int ingenic_drm_crtc_atomic_check(struct drm_crtc *crtc,
>  					 struct drm_crtc_state *state)
>  {
>  	struct ingenic_drm *priv = drm_crtc_get_priv(crtc);
> -	struct drm_plane_state *f1_state, *f0_state, *ipu_state;
> +	struct drm_plane_state *f1_state, *f0_state, *ipu_state = NULL;
>  	long rate;
>  
>  	if (!drm_atomic_crtc_needs_modeset(state))
> @@ -229,7 +229,7 @@ static int ingenic_drm_crtc_atomic_check(struct drm_crtc *crtc,
>  
>  		/* If all the planes are disabled, we won't get a VBLANK IRQ */
>  		priv->no_vblank = !f1_state->fb && !f0_state->fb &&
> -				  !(priv->ipu_plane && ipu_state->fb);
> +				  !(ipu_state && ipu_state->fb);
>  	}
>  
>  	return 0;
> -- 
> 2.27.0
_______________________________________________
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

* Re: [PATCH] drm/ingenic: Silence uninitialized-variable warning
  2020-07-19 10:23   ` Sam Ravnborg
@ 2020-07-19 11:08     ` Paul Cercueil
  -1 siblings, 0 replies; 6+ messages in thread
From: Paul Cercueil @ 2020-07-19 11:08 UTC (permalink / raw)
  To: Sam Ravnborg; +Cc: David Airlie, Daniel Vetter, od, dri-devel, linux-kernel

Hi Sam,

Le dim. 19 juil. 2020 à 12:23, Sam Ravnborg <sam@ravnborg.org> a 
écrit :
> Hi Paul.
> 
> On Sun, Jul 19, 2020 at 11:38:34AM +0200, Paul Cercueil wrote:
>>  Silence compiler warning about used but uninitialized 'ipu_state'
>>  variable. In practice, the variable would never be used when
>>  uninitialized, but the compiler cannot know that 'priv->ipu_plane' 
>> will
>>  always be NULL if CONFIG_INGENIC_IPU is disabled.
>> 
>>  Silence the warning by initializing the value to NULL.
>> 
>>  Signed-off-by: Paul Cercueil <paul@crapouillou.net>
> Patch looks good. Had to dig into the code to understand the
> change to the no_vblank flag.
> So:
> Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
> 
> I expect you to commit the patch.

Pushed, thanks.

> Looking at the code I noticed that the return value of
> drm_atomic_get_plane_state() is not checked.
> Can you try to look into this.

Right. I'll fix it.

-Paul

> 	Sam
> 
>>  ---
>>   drivers/gpu/drm/ingenic/ingenic-drm-drv.c | 4 ++--
>>   1 file changed, 2 insertions(+), 2 deletions(-)
>> 
>>  diff --git a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c 
>> b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
>>  index b6d946fbeaf5..ada990a7f911 100644
>>  --- a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
>>  +++ b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
>>  @@ -198,7 +198,7 @@ static int ingenic_drm_crtc_atomic_check(struct 
>> drm_crtc *crtc,
>>   					 struct drm_crtc_state *state)
>>   {
>>   	struct ingenic_drm *priv = drm_crtc_get_priv(crtc);
>>  -	struct drm_plane_state *f1_state, *f0_state, *ipu_state;
>>  +	struct drm_plane_state *f1_state, *f0_state, *ipu_state = NULL;
>>   	long rate;
>> 
>>   	if (!drm_atomic_crtc_needs_modeset(state))
>>  @@ -229,7 +229,7 @@ static int ingenic_drm_crtc_atomic_check(struct 
>> drm_crtc *crtc,
>> 
>>   		/* If all the planes are disabled, we won't get a VBLANK IRQ */
>>   		priv->no_vblank = !f1_state->fb && !f0_state->fb &&
>>  -				  !(priv->ipu_plane && ipu_state->fb);
>>  +				  !(ipu_state && ipu_state->fb);
>>   	}
>> 
>>   	return 0;
>>  --
>>  2.27.0



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

* Re: [PATCH] drm/ingenic: Silence uninitialized-variable warning
@ 2020-07-19 11:08     ` Paul Cercueil
  0 siblings, 0 replies; 6+ messages in thread
From: Paul Cercueil @ 2020-07-19 11:08 UTC (permalink / raw)
  To: Sam Ravnborg; +Cc: David Airlie, od, dri-devel, linux-kernel

Hi Sam,

Le dim. 19 juil. 2020 à 12:23, Sam Ravnborg <sam@ravnborg.org> a 
écrit :
> Hi Paul.
> 
> On Sun, Jul 19, 2020 at 11:38:34AM +0200, Paul Cercueil wrote:
>>  Silence compiler warning about used but uninitialized 'ipu_state'
>>  variable. In practice, the variable would never be used when
>>  uninitialized, but the compiler cannot know that 'priv->ipu_plane' 
>> will
>>  always be NULL if CONFIG_INGENIC_IPU is disabled.
>> 
>>  Silence the warning by initializing the value to NULL.
>> 
>>  Signed-off-by: Paul Cercueil <paul@crapouillou.net>
> Patch looks good. Had to dig into the code to understand the
> change to the no_vblank flag.
> So:
> Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
> 
> I expect you to commit the patch.

Pushed, thanks.

> Looking at the code I noticed that the return value of
> drm_atomic_get_plane_state() is not checked.
> Can you try to look into this.

Right. I'll fix it.

-Paul

> 	Sam
> 
>>  ---
>>   drivers/gpu/drm/ingenic/ingenic-drm-drv.c | 4 ++--
>>   1 file changed, 2 insertions(+), 2 deletions(-)
>> 
>>  diff --git a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c 
>> b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
>>  index b6d946fbeaf5..ada990a7f911 100644
>>  --- a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
>>  +++ b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
>>  @@ -198,7 +198,7 @@ static int ingenic_drm_crtc_atomic_check(struct 
>> drm_crtc *crtc,
>>   					 struct drm_crtc_state *state)
>>   {
>>   	struct ingenic_drm *priv = drm_crtc_get_priv(crtc);
>>  -	struct drm_plane_state *f1_state, *f0_state, *ipu_state;
>>  +	struct drm_plane_state *f1_state, *f0_state, *ipu_state = NULL;
>>   	long rate;
>> 
>>   	if (!drm_atomic_crtc_needs_modeset(state))
>>  @@ -229,7 +229,7 @@ static int ingenic_drm_crtc_atomic_check(struct 
>> drm_crtc *crtc,
>> 
>>   		/* If all the planes are disabled, we won't get a VBLANK IRQ */
>>   		priv->no_vblank = !f1_state->fb && !f0_state->fb &&
>>  -				  !(priv->ipu_plane && ipu_state->fb);
>>  +				  !(ipu_state && ipu_state->fb);
>>   	}
>> 
>>   	return 0;
>>  --
>>  2.27.0


_______________________________________________
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:[~2020-07-20  7:31 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-19  9:38 [PATCH] drm/ingenic: Silence uninitialized-variable warning Paul Cercueil
2020-07-19  9:38 ` Paul Cercueil
2020-07-19 10:23 ` Sam Ravnborg
2020-07-19 10:23   ` Sam Ravnborg
2020-07-19 11:08   ` Paul Cercueil
2020-07-19 11:08     ` Paul Cercueil

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.