aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSanjay Singh Rawat <sanjay.rawat@linaro.org>2013-04-17 15:02:01 +0530
committerSanjay Singh Rawat <sanjay.rawat@linaro.org>2013-04-17 16:06:36 +0530
commit5fef00517b11f837535d6549e8b5ba0835de54be (patch)
treefcdd25c11054de76338ef454f1c107418023ff22
parent83b37c3c2e20fffcdf53c546b6f0e287889cd451 (diff)
display proper error message
- bug : https://bugs.launchpad.net/linaro-powerdebug/+bug/1014667 Signed-off-by: Sanjay Singh Rawat <sanjay.rawat@linaro.org>
-rw-r--r--display.c4
-rw-r--r--powerdebug.c2
-rw-r--r--regulator.c4
-rw-r--r--tree.c4
4 files changed, 10 insertions, 4 deletions
diff --git a/display.c b/display.c
index 94ff2de..e9f4bf6 100644
--- a/display.c
+++ b/display.c
@@ -598,8 +598,10 @@ int display_register(int win, struct display_ops *ops)
{
size_t array_size = sizeof(windata) / sizeof(windata[0]);
- if (win < 0 || win >= array_size)
+ if (win < 0 || win >= array_size) {
+ printf("error: invalid window");
return -1;
+ }
windata[win].ops = ops;
diff --git a/powerdebug.c b/powerdebug.c
index 098c5da..6cf3a1b 100644
--- a/powerdebug.c
+++ b/powerdebug.c
@@ -247,7 +247,7 @@ int main(int argc, char **argv)
}
if (regulator_init()) {
- printf("not enough memory to allocate regulators info\n");
+ printf("failed to initialize regulator\n");
options->regulators = false;
}
diff --git a/regulator.c b/regulator.c
index 0da924a..68c686f 100644
--- a/regulator.c
+++ b/regulator.c
@@ -218,8 +218,10 @@ static int fill_regulator_cb(struct tree *t, void *data)
struct regulator_info *reg;
reg = regulator_alloc();
- if (!reg)
+ if (!reg) {
+ printf("error: unable to allocate memory for regulator\n");
return -1;
+ }
t->private = reg;
/* we skip the root node but we set it expanded for its children */
diff --git a/tree.c b/tree.c
index d331c60..686e846 100644
--- a/tree.c
+++ b/tree.c
@@ -121,8 +121,10 @@ static int tree_scan(struct tree *tree, tree_filter_t filter, bool follow)
int ret = 0;
dir = opendir(tree->path);
- if (!dir)
+ if (!dir) {
+ printf("error: unable to open directory %s\n", tree->path);
return -1;
+ }
while (!readdir_r(dir, &dirent, &direntp)) {