[Pdbg] [PATCH] main: Ignore nodes that do not have class names

Amitay Isaacs amitay at ozlabs.org
Fri Nov 16 14:54:25 AEDT 2018


It's possible that pdbg doesn't have hw units defined for all the nodes
in the device tree.  So if we encounter a node without class name ignore
that node while matching path.

Signed-off-by: Amitay Isaacs <amitay at ozlabs.org>
---
 src/path.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/path.c b/src/path.c
index 6b4e29b..0141085 100644
--- a/src/path.c
+++ b/src/path.c
@@ -222,6 +222,7 @@ static void path_pattern_match(struct pdbg_target *target,
 {
 	struct pdbg_target *child;
 	char comp_name[MAX_PATH_COMP_LEN];
+	const char *classname;
 	char *tok;
 	int next = level;
 	bool found = false;
@@ -236,7 +237,11 @@ static void path_pattern_match(struct pdbg_target *target,
 		goto end;
 	}
 
-	safe_strcpy(comp_name, sizeof(comp_name), pdbg_target_class_name(target));
+	classname = pdbg_target_class_name(target);
+	if (!classname)
+		goto end;
+
+	safe_strcpy(comp_name, sizeof(comp_name), classname);
 	if (pats[level].match_full) {
 		tok = comp_name;
 	} else {
-- 
2.19.1



More information about the Pdbg mailing list