Initialize tree pointers in the dump only option

The regulator, gpio, sensor and clock tree pointers were
initialized only during the display option and not during the
dump only option. This meant the dump option was not printing
any info previously. This patch fixes it by initilaizing the
tree pointers during the dump only option.

Signed-off-by: Thara Gopinath <thara.gopinath@linaro.org>
diff --git a/regulator.c b/regulator.c
index 5fba6f1..b452f2b 100644
--- a/regulator.c
+++ b/regulator.c
@@ -111,14 +111,6 @@
 	return 0;
 }
 
-int regulator_dump(void)
-{
-	printf("\nRegulator Information:\n");
-	printf("*********************\n\n");
-
-	return tree_for_each(reg_tree, regulator_dump_cb, NULL);
-}
-
 static int regulator_display_cb(struct tree *t, void *data)
 {
 	struct regulator_info *reg = t->private;
@@ -261,6 +253,24 @@
 	return 0;
 }
 
+int regulator_dump(void)
+{
+
+	if (!reg_tree) {
+		reg_tree = tree_load(SYSFS_REGULATOR, regulator_filter_cb,
+							false);
+		if (!reg_tree) {
+			printf("Failed to load regulator tree\n");
+			return -1;
+		}
+	}
+
+	printf("\nRegulator Information:\n");
+	printf("*********************\n\n");
+
+	return tree_for_each(reg_tree, regulator_dump_cb, NULL);
+}
+
 static int regulator_display(bool refresh)
 {
 	if (regulator_info_load()) {