bugfix: tools: p2a: read returns bool
The read method returns bool, therefore if this returns 0, it's false,
and therefore the read failed.
Signed-off-by: Patrick Venture <venture@google.com>
Change-Id: I365f9edf49a79ca5ea3c13090d6b8a11b9598e53
diff --git a/tools/p2a.cpp b/tools/p2a.cpp
index 0ac5eb3..b5fa8a4 100644
--- a/tools/p2a.cpp
+++ b/tools/p2a.cpp
@@ -73,11 +73,14 @@
std::uint32_t value;
if (!io->read(bar1 | aspeedP2aConfig, sizeof(value), &value))
{
- if (0 == (value & p2ABridgeEnabled))
- {
- std::fprintf(stderr, "Bridge not enabled.\n");
- return false;
- }
+ std::fprintf(stderr, "PCI config read failed\n");
+ return false;
+ }
+
+ if (0 == (value & p2ABridgeEnabled))
+ {
+ std::fprintf(stderr, "Bridge not enabled.\n");
+ return false;
}
std::fprintf(stderr, "The bridge is enabled!\n");