aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Lezcano <daniel.lezcano@linaro.org>2011-06-08 23:30:00 +0200
committerDaniel Lezcano <daniel.lezcano@free.fr>2011-06-08 23:30:00 +0200
commit95b0dac4497fe76853045b16a800e28a67585b3d (patch)
tree224051a51284135344b8de8ad523f52027d9ec98
parent68500e84c1d76c3db5919cf9b7f179eecbeee718 (diff)
downloadpowerdebug-95b0dac4497fe76853045b16a800e28a67585b3d.tar.gz
fix segfault when the default window is not the clock
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
-rw-r--r--clocks.c2
-rw-r--r--powerdebug.c11
2 files changed, 5 insertions, 8 deletions
diff --git a/clocks.c b/clocks.c
index d08c926..ecc72ea 100644
--- a/clocks.c
+++ b/clocks.c
@@ -255,7 +255,7 @@ int read_and_print_clock_info(int verbose, int hrow, int selected)
read_clock_info(clk_dir_path);
}
- if (!clocks_info->num_children) {
+ if (!clocks_info || !clocks_info->num_children) {
fprintf(stderr, "powerdebug: No clocks found. Exiting..\n");
exit(1);
}
diff --git a/powerdebug.c b/powerdebug.c
index 5fe07de..94dd31a 100644
--- a/powerdebug.c
+++ b/powerdebug.c
@@ -251,19 +251,18 @@ int mainloop(struct powerdebug_options *options,
create_windows(options->selectedwindow);
show_header(options->selectedwindow);
+ create_selectedwindow(options->selectedwindow);
- if (options->regulators || options->selectedwindow == REGULATOR) {
+ if (options->selectedwindow == REGULATOR) {
regulator_read_info(reg_info, nr_reg);
- create_selectedwindow(options->selectedwindow);
show_regulator_info(reg_info, nr_reg,
options->verbose);
}
- if (options->clocks || options->selectedwindow == CLOCK) {
+ if (options->selectedwindow == CLOCK) {
int hrow;
- create_selectedwindow(options->selectedwindow);
if (!findparent_ncurses) {
int command = 0;
@@ -282,10 +281,8 @@ int mainloop(struct powerdebug_options *options,
enter_hit);
}
- if (options->sensors || options->selectedwindow == SENSOR) {
- create_selectedwindow(options->selectedwindow);
+ if (options->selectedwindow == SENSOR)
print_sensor_header();
- }
FD_ZERO(&readfds);
FD_SET(0, &readfds);