All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/amdgpu: Initialize variable before use
@ 2019-09-30 20:09 ` Siqueira, Rodrigo
  0 siblings, 0 replies; 3+ messages in thread
From: Siqueira, Rodrigo @ 2019-09-30 20:09 UTC (permalink / raw)
  To: amd-gfx, dri-devel, linux-kernel
  Cc: Wentland, Harry, Li, Sun peng (Leo),
	Deucher, Alexander, Koenig, Christian, Zhou, David(ChunMing),
	David Airlie, Daniel Vetter, Kazlauskas, Nicholas

[-- Attachment #1: Type: text/plain, Size: 1445 bytes --]

The 'debug_data' variable gets printed in debug statements without a
prior initialization in the function
hubbub1_verify_allow_pstate_change_high, as reported when building with
gcc 9.1.0:

warning: ‘debug_data’ may be used uninitialized in this function [-Wmaybe-uninitialized]
  290 |  printk##once(KERN_##level "[" DRM_NAME "] " fmt, ##__VA_ARGS__)
      |  ^~~~~~
dc/dcn10/dcn10_hubbub.c:134:15: note: ‘debug_data’ was declared here
  134 |  unsigned int debug_data;

Note that initialize debug_data with 0, in this case, is safe because we
have a loop in a few lines below that will initialize this variable with
the proper value.

Signed-off-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
---
 drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hubbub.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hubbub.c b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hubbub.c
index a780057e2dbc..b6967a7e6c7b 100644
--- a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hubbub.c
+++ b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hubbub.c
@@ -133,7 +133,7 @@ bool hubbub1_verify_allow_pstate_change_high(
 	static unsigned int max_sampled_pstate_wait_us; /* data collection */
 	static bool forced_pstate_allow; /* help with revert wa */
 
-	unsigned int debug_data;
+	unsigned int debug_data = 0;
 	unsigned int i;
 
 	if (forced_pstate_allow) {
-- 
2.23.0

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* [PATCH] drm/amdgpu: Initialize variable before use
@ 2019-09-30 20:09 ` Siqueira, Rodrigo
  0 siblings, 0 replies; 3+ messages in thread
From: Siqueira, Rodrigo @ 2019-09-30 20:09 UTC (permalink / raw)
  To: amd-gfx, dri-devel, linux-kernel
  Cc: Li, Sun peng (Leo),
	Kazlauskas, Nicholas, David Airlie, Deucher, Alexander, Koenig,
	Christian


[-- Attachment #1.1: Type: text/plain, Size: 1445 bytes --]

The 'debug_data' variable gets printed in debug statements without a
prior initialization in the function
hubbub1_verify_allow_pstate_change_high, as reported when building with
gcc 9.1.0:

warning: ‘debug_data’ may be used uninitialized in this function [-Wmaybe-uninitialized]
  290 |  printk##once(KERN_##level "[" DRM_NAME "] " fmt, ##__VA_ARGS__)
      |  ^~~~~~
dc/dcn10/dcn10_hubbub.c:134:15: note: ‘debug_data’ was declared here
  134 |  unsigned int debug_data;

Note that initialize debug_data with 0, in this case, is safe because we
have a loop in a few lines below that will initialize this variable with
the proper value.

Signed-off-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
---
 drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hubbub.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hubbub.c b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hubbub.c
index a780057e2dbc..b6967a7e6c7b 100644
--- a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hubbub.c
+++ b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hubbub.c
@@ -133,7 +133,7 @@ bool hubbub1_verify_allow_pstate_change_high(
 	static unsigned int max_sampled_pstate_wait_us; /* data collection */
 	static bool forced_pstate_allow; /* help with revert wa */
 
-	unsigned int debug_data;
+	unsigned int debug_data = 0;
 	unsigned int i;
 
 	if (forced_pstate_allow) {
-- 
2.23.0

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

[-- Attachment #2: Type: text/plain, Size: 159 bytes --]

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

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

* Re: [PATCH] drm/amdgpu: Initialize variable before use
  2019-09-30 20:09 ` Siqueira, Rodrigo
  (?)
@ 2019-10-02 13:41 ` Alex Deucher
  -1 siblings, 0 replies; 3+ messages in thread
From: Alex Deucher @ 2019-10-02 13:41 UTC (permalink / raw)
  To: Siqueira, Rodrigo
  Cc: amd-gfx, dri-devel, linux-kernel, Zhou, David(ChunMing),
	Li, Sun peng (Leo),
	Kazlauskas, Nicholas, David Airlie, Daniel Vetter, Deucher,
	Alexander, Wentland, Harry, Koenig, Christian

On Mon, Sep 30, 2019 at 4:09 PM Siqueira, Rodrigo
<Rodrigo.Siqueira@amd.com> wrote:
>
> The 'debug_data' variable gets printed in debug statements without a
> prior initialization in the function
> hubbub1_verify_allow_pstate_change_high, as reported when building with
> gcc 9.1.0:
>
> warning: ‘debug_data’ may be used uninitialized in this function [-Wmaybe-uninitialized]
>   290 |  printk##once(KERN_##level "[" DRM_NAME "] " fmt, ##__VA_ARGS__)
>       |  ^~~~~~
> dc/dcn10/dcn10_hubbub.c:134:15: note: ‘debug_data’ was declared here
>   134 |  unsigned int debug_data;
>
> Note that initialize debug_data with 0, in this case, is safe because we
> have a loop in a few lines below that will initialize this variable with
> the proper value.
>
> Signed-off-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

> ---
>  drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hubbub.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hubbub.c b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hubbub.c
> index a780057e2dbc..b6967a7e6c7b 100644
> --- a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hubbub.c
> +++ b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hubbub.c
> @@ -133,7 +133,7 @@ bool hubbub1_verify_allow_pstate_change_high(
>         static unsigned int max_sampled_pstate_wait_us; /* data collection */
>         static bool forced_pstate_allow; /* help with revert wa */
>
> -       unsigned int debug_data;
> +       unsigned int debug_data = 0;
>         unsigned int i;
>
>         if (forced_pstate_allow) {
> --
> 2.23.0
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx

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

end of thread, other threads:[~2019-10-02 13:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-30 20:09 [PATCH] drm/amdgpu: Initialize variable before use Siqueira, Rodrigo
2019-09-30 20:09 ` Siqueira, Rodrigo
2019-10-02 13:41 ` Alex Deucher

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.