* [Powertop] [PATCH] Fix compile warning in cpu.cpp
@ 2014-06-05 0:35 Srinivas Pandruvada
0 siblings, 0 replies; 2+ messages in thread
From: Srinivas Pandruvada @ 2014-06-05 0:35 UTC (permalink / raw)
To: powertop
[-- Attachment #1: Type: text/plain, Size: 2026 bytes --]
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Powertop] [PATCH] Fix compile warning in cpu.cpp
@ 2014-06-10 21:41 Alexandra Yates
0 siblings, 0 replies; 2+ messages in thread
From: Alexandra Yates @ 2014-06-10 21:41 UTC (permalink / raw)
To: powertop
[-- Attachment #1: Type: text/plain, Size: 2448 bytes --]
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.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-06-10 21:41 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-05 0:35 [Powertop] [PATCH] Fix compile warning in cpu.cpp Srinivas Pandruvada
2014-06-10 21:41 Alexandra Yates
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.