From: Pali Rohár Date: Fri, 31 Dec 2021 13:39:51 +0000 (+0100) Subject: lspci: Do not show -[00]- bus in tree output X-Git-Tag: v3.8.0~33 X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=fd9c6a29a32659287cb7be52b2f2ca638cda35ad;p=pciutils.git lspci: Do not show -[00]- bus in tree output Secondary or subordinate bus cannot be zero. Zero value could indicate either invalid secondary bus value or the fact that secondary bus value was not filled or indicates non-compliant PCI-to-PCI bridge. This change makes tree output better readable when bus numbers are not known or not provided. --- diff --git a/ls-tree.c b/ls-tree.c index fede581..f8154a2 100644 --- a/ls-tree.c +++ b/ls-tree.c @@ -258,7 +258,9 @@ show_tree_dev(struct device *d, char *line, char *p) for (b=&host_bridge; b; b=b->chain) if (b->br_dev == d) { - if (b->secondary == b->subordinate) + if (b->secondary == 0) + p = tree_printf(line, p, "-"); + else if (b->secondary == b->subordinate) p = tree_printf(line, p, "-[%02x]-", b->secondary); else p = tree_printf(line, p, "-[%02x-%02x]-", b->secondary, b->subordinate);