bugfix: result.bars[1] may be used uninitialized
Tools bugfix where if the result isn't assigned, it's still used.
Therefore, add a proper exit condition. This was developed on a system
with the device, and interestingly, this compilation warning->error
wasn't hit during CI, only with bitbake. Therefore, different flags
must be involved between the two.
Signed-off-by: Patrick Venture <venture@google.com>
Change-Id: Ifca7046657b65a425b0c3bf4fe05dd42bd7a8a14
diff --git a/tools/p2a.cpp b/tools/p2a.cpp
index 6d4b693..5f9880a 100644
--- a/tools/p2a.cpp
+++ b/tools/p2a.cpp
@@ -27,6 +27,7 @@
PciDevice result;
PciUtilImpl pci;
PciFilter filter;
+ bool found = false;
filter.vid = aspeedVendorId;
filter.did = aspeedDeviceId;
@@ -46,7 +47,15 @@
}
result = d;
+ found = true;
+ break;
}
+
+ if (!found)
+ {
+ return false;
+ }
+
std::fprintf(stderr, "\n");
/* We sent the open command before this, so the window should be open and