From: Kelsey Skunberg <skunberg.kelsey@gmail.com>
To: linux-pci@vger.kernel.org
Cc: skhan@linuxfoundation.org,
linux-kernel-mentees@lists.linuxfoundation.org, mj@ucw.cz,
bjorn@helgaas.com, skunberg.kelsey@gmail.com
Subject: [PATCH v4 2/3] lspci: Remove unnecessary !verbose check in show_range()
Date: Wed, 19 Jun 2019 10:48:57 -0600 [thread overview]
Message-ID: <20190619164858.84746-3-skunberg.kelsey@gmail.com> (raw)
In-Reply-To: <20190619164858.84746-1-skunberg.kelsey@gmail.com>
Remove 'if (!verbose)' code in show_range() due to not being called.
show_range() will only be called when verbose is true. Additional call
to check for verbosity within show_range() is dead code.
!verbose was used so nothing would print if the range behind a bridge
had a base > limit and verbose == false. Since show_range() will not be
called when verbose == false, not printing bridge information is
still accomplished.
Signed-off-by: Kelsey Skunberg <skunberg.kelsey@gmail.com>
---
lspci.c | 12 +++---------
1 file changed, 3 insertions(+), 9 deletions(-)
diff --git a/lspci.c b/lspci.c
index 937c6e4..7418b07 100644
--- a/lspci.c
+++ b/lspci.c
@@ -376,17 +376,11 @@ show_size(u64 x)
static void
show_range(char *prefix, u64 base, u64 limit, int is_64bit)
{
- if (base > limit)
+ if (base > limit && verbose < 3)
{
- if (!verbose)
- return;
- else if (verbose < 3)
- {
- printf("%s: None\n", prefix);
- return;
- }
+ printf("%s: None\n", prefix);
+ return;
}
-
printf("%s: ", prefix);
if (is_64bit)
printf("%016" PCI_U64_FMT_X "-%016" PCI_U64_FMT_X, base, limit);
--
2.20.1
next prev parent reply other threads:[~2019-06-19 16:51 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-19 16:48 [PATCH v4 0/3] lspci: Update verbose help and show_range() Kelsey Skunberg
2019-06-19 16:48 ` [PATCH v4 1/3] lspci: Include -vvv option in help Kelsey Skunberg
2019-06-19 16:48 ` Kelsey Skunberg [this message]
2019-06-19 16:48 ` [PATCH v4 3/3] lspci: Change output for bridge with empty range to "[disabled]" Kelsey Skunberg
2019-06-19 19:44 ` [PATCH v4 0/3] lspci: Update verbose help and show_range() Bjorn Helgaas
2020-01-21 20:52 ` Martin Mareš
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190619164858.84746-3-skunberg.kelsey@gmail.com \
--to=skunberg.kelsey@gmail.com \
--cc=bjorn@helgaas.com \
--cc=linux-kernel-mentees@lists.linuxfoundation.org \
--cc=linux-pci@vger.kernel.org \
--cc=mj@ucw.cz \
--cc=skhan@linuxfoundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).