@@ -405,9 +405,6 @@ int clock_init(void)
{
char clk_dir_path[PATH_MAX];
- if (display_register(CLOCK, &clock_ops))
- return -1;
-
if (locate_debugfs(clk_dir_path))
return -1;
@@ -420,5 +417,8 @@ int clock_init(void)
if (!clock_tree)
return -1;
- return fill_clock_tree();
+ if (fill_clock_tree())
+ return -1;
+
+ return display_register(CLOCK, &clock_ops);
}
@@ -120,7 +120,10 @@ static int display_refresh(int win, bool read)
if (windata[win].ops && windata[win].ops->display)
return windata[win].ops->display(read);
- return 0;
+ if (werase(main_win))
+ return -1;
+
+ return wrefresh(main_win);
}
int display_refresh_pad(int win)
@@ -236,12 +236,12 @@ static struct display_ops regulator_ops = {
int regulator_init(void)
{
- if (display_register(REGULATOR, ®ulator_ops))
- return -1;
-
reg_tree = tree_load(SYSFS_REGULATOR, regulator_filter_cb);
if (!reg_tree)
return -1;
- return fill_regulator_tree();
+ if (fill_regulator_tree())
+ return -1;
+
+ return display_register(REGULATOR, ®ulator_ops);
}
@@ -271,12 +271,12 @@ static struct display_ops sensor_ops = {
int sensor_init(void)
{
- if (display_register(SENSOR, &sensor_ops))
- return -1;
-
sensor_tree = tree_load(SYSFS_SENSOR, sensor_filter_cb);
if (!sensor_tree)
return -1;
- return fill_sensor_tree();
+ if (fill_sensor_tree())
+ return -1;
+
+ return display_register(SENSOR, &sensor_ops);
}
When there is no clock available, we even register the display ops. The 'enter' callbakc is set but not data is available int the row private data which leads to a segfaults. This patch fix this problem by not registering the ops if the pm subsystem was not correctly initialized. In the meantime, we have to erase the window when we are switching from one window to another. We can say it is the "default" display callback. Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> Reported-by: Milo (Woogyom) Kim <woogyom.kim@gmail.com> --- clocks.c | 8 ++++---- display.c | 5 ++++- regulator.c | 8 ++++---- sensor.c | 8 ++++---- 4 files changed, 16 insertions(+), 13 deletions(-)