diff mbox series

main: Ignore nodes that do not have class names

Message ID 20181116035425.258801-1-amitay@ozlabs.org
State Accepted
Headers show
Series main: Ignore nodes that do not have class names | expand

Checks

Context Check Description
snowpatch_ozlabs/apply_patch success master/apply_patch Successfully applied
snowpatch_ozlabs/build-multiarch success Test build-multiarch on branch master

Commit Message

Amitay Isaacs Nov. 16, 2018, 3:54 a.m. UTC
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@ozlabs.org>
---
 src/path.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
diff mbox series

Patch

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 {