Skip to content

Commit af444ec

Browse files
committed
hw: Avoid function calls in asserts
1 parent 25a61bf commit af444ec

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

src/drivers/vmxnet3.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,6 @@ vmxnet3::vmxnet3(hw::PCI_Device& d) :
118118
INFO2("[x] Device has %u MSI-X vectors", msix_vectors);
119119
assert(msix_vectors >= 3);
120120
if (msix_vectors > 3) msix_vectors = 3;
121-
std::vector<uint8_t> irqs;
122121

123122
for (int i = 0; i < msix_vectors; i++)
124123
{
@@ -144,10 +143,12 @@ vmxnet3::vmxnet3(hw::PCI_Device& d) :
144143
assert(this->ptbase);
145144

146145
// verify and select version
147-
assert(check_version());
146+
bool ok = check_version();
147+
assert(ok);
148148

149149
// reset device
150-
assert(reset());
150+
ok = reset();
151+
assert(ok);
151152

152153
// get mac address
153154
retrieve_hwaddr();

src/hw/pci_device.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,8 @@ namespace hw {
183183

184184
// enable MSI-x if its supported
185185
if (this->msix_cap()) {
186-
assert(this->init_msix());
186+
int vectors = this->init_msix();
187+
assert(vectors > 0);
187188
}
188189
}
189190

0 commit comments

Comments
 (0)