mem: Check return value of checkFunctional in SimpleMemory
authorAndreas Hansson <andreas.hansson@arm.com>
Fri, 19 Sep 2014 14:35:06 +0000 (10:35 -0400)
committerAndreas Hansson <andreas.hansson@arm.com>
Fri, 19 Sep 2014 14:35:06 +0000 (10:35 -0400)
Simple fix to ensure we only iterate until we are done.

src/mem/simple_mem.cc

index 2549cbe3990a1b2641026aa23d07fcbc45acebdd..b2d518dc76442f31f18a910ab03b5f905b6ae60a 100644 (file)
@@ -80,9 +80,13 @@ SimpleMemory::recvFunctional(PacketPtr pkt)
 
     functionalAccess(pkt);
 
+    bool done = false;
+    auto p = packetQueue.begin();
     // potentially update the packets in our packet queue as well
-    for (auto i = packetQueue.begin(); i != packetQueue.end(); ++i)
-        pkt->checkFunctional(i->pkt);
+    while (!done && p != packetQueue.end()) {
+        done = pkt->checkFunctional(p->pkt);
+        ++p;
+    }
 
     pkt->popLabel();
 }