]> git.ipfire.org Git - thirdparty/pciutils.git/blobdiff - ls-tree.c
ls-ecaps: extend decode support for more fields for AER CE and UE status
[thirdparty/pciutils.git] / ls-tree.c
index 43ff9b1ae47ca320a38ef3cb64b9c5be869c6a41..5189930e70f2cb1dd6f7628ca7cf656cf3fd9c64 100644 (file)
--- a/ls-tree.c
+++ b/ls-tree.c
@@ -3,7 +3,9 @@
  *
  *     Copyright (c) 1997--2021 Martin Mares <mj@ucw.cz>
  *
- *     Can be freely distributed and used under the terms of the GNU GPL.
+ *     Can be freely distributed and used under the terms of the GNU GPL v2+.
+ *
+ *     SPDX-License-Identifier: GPL-2.0-or-later
  */
 
 #include <stdarg.h>
@@ -12,7 +14,7 @@
 
 #include "lspci.h"
 
-struct bridge host_bridge = { NULL, NULL, NULL, NULL, NULL, 0, ~0, 0, ~0, NULL };
+struct bridge host_bridge = { NULL, NULL, NULL, NULL, NULL, NULL, ~0, ~0, ~0, ~0, NULL };
 
 static struct bus *
 find_bus(struct bridge *b, unsigned int domain, unsigned int n)
@@ -127,7 +129,7 @@ grow_tree(void)
       b->subordinate = ~0;
       *last_br = b;
       last_br = &b->chain;
-      b->prev = b->child = NULL;
+      b->prev = b->next = b->child = NULL;
       b->first_bus = NULL;
       b->last_bus = NULL;
       b->br_dev = NULL;
@@ -160,7 +162,7 @@ grow_tree(void)
            }
          *last_br = b;
          last_br = &b->chain;
-         b->prev = b->child = NULL;
+         b->prev = b->next = b->child = NULL;
          b->first_bus = NULL;
          b->last_bus = NULL;
          b->br_dev = d;
@@ -188,7 +190,7 @@ grow_tree(void)
       b->subordinate = b->secondary;
       *last_br = b;
       last_br = &b->chain;
-      b->prev = b->child = NULL;
+      b->prev = b->next = b->child = NULL;
       b->first_bus = NULL;
       b->last_bus = NULL;
       b->br_dev = parent;
@@ -459,6 +461,8 @@ show_forest(struct pci_filter *filter)
   if (host_bridge.child)
     {
       for (b=host_bridge.child; b->prev; b=b->prev)
+        b->prev->next = b;
+      for (; b; b=b->next)
         show_tree_bridge(filter, b, line, line);
     }
 }