Signed-off-by: Daniel Lezcano <[email protected]>
---
powerdebug.c | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/powerdebug.c b/powerdebug.c
index 555beea..bc8fc92 100644
--- a/powerdebug.c
+++ b/powerdebug.c
@@ -208,13 +208,12 @@ static struct powerdebug_options *powerdebug_init(void)
{
struct powerdebug_options *options;
+ signal(SIGWINCH, sigwinch_handler);
+
options = malloc(sizeof(*options));
if (!options)
return NULL;
- memset(options, 0, sizeof(*options));
- signal(SIGWINCH, sigwinch_handler);
-
return options;
}
@@ -249,22 +248,22 @@ int main(int argc, char **argv)
return 1;
}
- if (regulator_init()) {
+ if ((options->flags & REGULATOR_OPTION) && regulator_init()) {
printf("failed to initialize regulator\n");
options->flags &= ~REGULATOR_OPTION;
}
- if (clock_init()) {
+ if ((options->flags & CLOCK_OPTION) && clock_init()) {
printf("failed to initialize clock details (check debugfs)\n");
options->flags &= ~CLOCK_OPTION;
}
- if (sensor_init()) {
+ if ((options->flags & SENSOR_OPTION) && sensor_init()) {
printf("failed to initialize sensors\n");
options->flags &= SENSOR_OPTION;
}
- if (gpio_init()) {
+ if ((options->flags & GPIO_OPTION) && gpio_init()) {
printf("failed to initialize gpios\n");
options->flags &= GPIO_OPTION;
}
--
1.9.1
_______________________________________________
linaro-dev mailing list
[email protected]
https://lists.linaro.org/mailman/listinfo/linaro-dev