Re: [Powertop] [PATCH] Fix compile warning in cpu.cpp
Alexandra Yates <alexandra.yates at linux.intel.com>
| Newsgroups | dev.linux.lists.powertop |
|---|---|
| Message-ID | <[email protected]> |
Hi Srinivas,
Thank you for sending your patches, they were added today.
Thank you,
Alexandra.
> Fix
> cpu/cpu.cpp: In function âvoid report_display_cpu_cstates()â:
> cpu/cpu.cpp:616:28: warning: â_coreâ may be used uninitialized in this
> function [-Wmaybe-uninitialized]
> cpu/cpu.cpp: In function âvoid report_display_cpu_pstates()â:
> cpu/cpu.cpp:797:27: warning: â_coreâ may be used uninitialized in this
> function [-Wmaybe-uninitialized]
> ---
> src/cpu/cpu.cpp | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/src/cpu/cpu.cpp b/src/cpu/cpu.cpp
> index 37cc409..d360f2f 100644
> --- a/src/cpu/cpu.cpp
> +++ b/src/cpu/cpu.cpp
> @@ -428,7 +428,7 @@ void report_display_cpu_cstates(void)
> char buffer[512], buffer2[512], tmp_num[50];
> unsigned int package, core, cpu;
> int line, cstates_num, title=0, core_num=0;
> - class abstract_cpu *_package, * _core, * _cpu;
> + class abstract_cpu *_package, *_core = NULL, * _cpu;
> const char* core_type = NULL;
>
> cstates_num = get_cstates_num();
> @@ -608,7 +608,7 @@ void report_display_cpu_cstates(void)
> /* Report Output */
> if(core_num > 0)
> title=title/core_num;
> - else if( _core->children.size() > 0)
> + else if(_core && _core->children.size() > 0)
> title=title/_core->children.size();
>
> init_pkg_table_attr(&std_table_css, pkg_tbl_size.rows,
> pkg_tbl_size.cols);
> @@ -630,7 +630,7 @@ void report_display_cpu_pstates(void)
> char buffer[512], buffer2[512], tmp_num[50];
> unsigned int package, core, cpu;
> int line, title=0;
> - class abstract_cpu *_package, * _core, * _cpu;
> + class abstract_cpu *_package, *_core = NULL, * _cpu;
> unsigned int i, pstates_num;
> const char* core_type = NULL;
>
> @@ -794,7 +794,7 @@ void report_display_cpu_pstates(void)
> }
> init_pkg_table_attr(&std_table_css, pkg_tbl_size.rows,
> pkg_tbl_size.cols);
> report.add_table(pkg_data, &std_table_css);
> - if(!_core->can_collapse()){
> + if(_core && !_core->can_collapse()){
> title=pstates_num+2;
> init_core_table_attr(&std_table_css, title,
> core_tbl_size.rows, core_tbl_size.cols);
> --
> 1.7.11.7
>
> _______________________________________________
> PowerTop mailing list
> PowerTop(a)lists.01.org
> https://lists.01.org/mailman/listinfo/powertop
>
Thank you,
Alexandra.