Re: [PATCH] drm/amdgpu: Initialize variable before use

2019-10-02 Thread Alex Deucher
On Mon, Sep 30, 2019 at 4:09 PM Siqueira, Rodrigo
 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 

Reviewed-by: Alex Deucher 

> ---
>  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


[PATCH] drm/amdgpu: Initialize variable before use

2019-09-30 Thread Siqueira, Rodrigo
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 
---
 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


signature.asc
Description: PGP signature
___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx