[Pdbg] [PATCH 4/6] libpdbg: Fix clang warning -Wuninitialized

Amitay Isaacs amitay at ozlabs.org
Wed Jun 19 13:15:48 AEST 2019


Signed-off-by: Amitay Isaacs <amitay at ozlabs.org>
---
 libpdbg/device.c | 4 ++--
 libpdbg/target.c | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/libpdbg/device.c b/libpdbg/device.c
index b7fd49f..b71170c 100644
--- a/libpdbg/device.c
+++ b/libpdbg/device.c
@@ -162,7 +162,7 @@ static int dt_cmp_subnodes(const struct pdbg_target *a, const struct pdbg_target
 
 static bool dt_attach_root(struct pdbg_target *parent, struct pdbg_target *root)
 {
-	struct pdbg_target *node;
+	struct pdbg_target *node = NULL;
 
 	assert(!root->parent);
 
@@ -305,7 +305,7 @@ static struct pdbg_target *dt_find_by_path(struct pdbg_target *root, const char
 static struct dt_property *dt_find_property(const struct pdbg_target *node,
 					   const char *name)
 {
-	struct dt_property *i;
+	struct dt_property *i = NULL;
 
 	list_for_each(&node->properties, i, list)
 		if (strcmp(i->name, name) == 0)
diff --git a/libpdbg/target.c b/libpdbg/target.c
index 40fe690..066f616 100644
--- a/libpdbg/target.c
+++ b/libpdbg/target.c
@@ -283,7 +283,7 @@ struct pdbg_target *require_target_parent(struct pdbg_target *target)
 /* Finds the given class. Returns NULL if not found. */
 struct pdbg_target_class *find_target_class(const char *name)
 {
-	struct pdbg_target_class *target_class;
+	struct pdbg_target_class *target_class = NULL;
 
 	list_for_each(&target_classes, target_class, class_head_link)
 		if (!strcmp(target_class->name, name))
-- 
2.21.0



More information about the Pdbg mailing list