From patchwork Fri Nov 16 03:54:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amitay Isaacs X-Patchwork-Id: 998728 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42x49n5jT0z9sBn for ; Fri, 16 Nov 2018 14:54:37 +1100 (AEDT) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ozlabs.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=ozlabs.org header.i=@ozlabs.org header.b="I3D8VaSG"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 42x49n2pJGzF3j5 for ; Fri, 16 Nov 2018 14:54:37 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=ozlabs.org Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=ozlabs.org header.i=@ozlabs.org header.b="I3D8VaSG"; dkim-atps=neutral X-Original-To: pdbg@lists.ozlabs.org Delivered-To: pdbg@lists.ozlabs.org Received: from ozlabs.org (bilbo.ozlabs.org [IPv6:2401:3900:2:1::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 42x49g6QfLzF3hw for ; Fri, 16 Nov 2018 14:54:31 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=ozlabs.org Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=ozlabs.org header.i=@ozlabs.org header.b="I3D8VaSG"; dkim-atps=neutral Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPSA id 42x49g2QHhz9sB5; Fri, 16 Nov 2018 14:54:31 +1100 (AEDT) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ozlabs.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ozlabs.org; s=201707; t=1542340471; bh=s6zcYvCSYVeGl4Z1jbzRxupo3gaa0CQPuA3SXj8I7kU=; h=From:To:Cc:Subject:Date:From; b=I3D8VaSG7/veIO5NTHGhCJCuehuo9LSYAItFsQlTVIQHyhWzSHNVXplKnKsEvdVbc D08noGPZYIlX65jspGvn3+Afplfhm0KyJQot58XqryHApiG3NSvKjRh8O++dZnGqXZ O2ib0JTp6kiTkDeeZpS/qu6+sqeAD/WWDutGEznkZs+CV4VLx6ezAmXWCJO3hjXBCM gE+dX2+nh+cV5SqTwy06MQZxAtdRBdoCQE1laRqEesnLs5+kYEkMN8/bVRLJ+nzUtO QdBGd6w9Fu5txpvNtH15p7LKfrXzyHYN1CIfGEXs3stc+h2taWFIKhGwwcelUK5zE2 gbYdtjcgS/DvA== From: Amitay Isaacs To: pdbg@lists.ozlabs.org Date: Fri, 16 Nov 2018 14:54:25 +1100 Message-Id: <20181116035425.258801-1-amitay@ozlabs.org> X-Mailer: git-send-email 2.19.1 MIME-Version: 1.0 Subject: [Pdbg] [PATCH] main: Ignore nodes that do not have class names X-BeenThere: pdbg@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "mailing list for https://github.com/open-power/pdbg development" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Amitay Isaacs Errors-To: pdbg-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Pdbg" 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 --- 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 {