diff options
author | Andreas Hansson <andreas.hansson@arm.com> | 2012-09-11 14:15:47 -0400 |
---|---|---|
committer | Andreas Hansson <andreas.hansson@arm.com> | 2012-09-11 14:15:47 -0400 |
commit | 292d8252a4a03b7f2ef48f6f86311ac35020095d (patch) | |
tree | 54c6914006282e7c4966ea82b64494250f39baea /src/mem | |
parent | 9ad7e23e9e277b13fd7cbe3b123b2d72f8817269 (diff) | |
download | gem5-292d8252a4a03b7f2ef48f6f86311ac35020095d.tar.xz |
clang: Fix issues identified by the clang static analyzer
This patch addresses a few minor issues reported by the clang static
analyzer.
The analysis was run with:
scan-build -disable-checker deadcode \
-enable-checker experimental.core \
-disable-checker experimental.core.CastToStruct \
-enable-checker experimental.cpluscplus
Diffstat (limited to 'src/mem')
-rw-r--r-- | src/mem/cache/tags/iic.cc | 33 | ||||
-rw-r--r-- | src/mem/ruby/system/Sequencer.cc | 3 |
2 files changed, 18 insertions, 18 deletions
diff --git a/src/mem/cache/tags/iic.cc b/src/mem/cache/tags/iic.cc index e8b0a1b29..45807ef28 100644 --- a/src/mem/cache/tags/iic.cc +++ b/src/mem/cache/tags/iic.cc @@ -352,33 +352,32 @@ IIC::freeReplacementBlock(PacketList & writebacks) unsigned long data_ptr; /* consult replacement policy */ tag_ptr = &tagStore[repl->getRepl()]; + assert(tag_ptr != NULL); assert(tag_ptr->isValid()); DPRINTF(Cache, "Replacing %x in IIC: %s\n", regenerateBlkAddr(tag_ptr->tag,0), tag_ptr->isDirty() ? "writeback" : "clean"); /* write back replaced block data */ - if (tag_ptr && (tag_ptr->isValid())) { - replacements[0]++; - totalRefs += tag_ptr->refCount; - ++sampledRefs; - tag_ptr->refCount = 0; + replacements[0]++; + totalRefs += tag_ptr->refCount; + ++sampledRefs; + tag_ptr->refCount = 0; - if (tag_ptr->isDirty()) { + if (tag_ptr->isDirty()) { /* PacketPtr writeback = - buildWritebackReq(regenerateBlkAddr(tag_ptr->tag, 0), - tag_ptr->req->asid, tag_ptr->xc, blkSize, - tag_ptr->data, - tag_ptr->size); + buildWritebackReq(regenerateBlkAddr(tag_ptr->tag, 0), + tag_ptr->req->asid, tag_ptr->xc, blkSize, + tag_ptr->data, + tag_ptr->size); */ - Request *writebackReq = new Request(regenerateBlkAddr(tag_ptr->tag, 0), - blkSize, 0, Request::wbMasterId); - PacketPtr writeback = new Packet(writebackReq, MemCmd::Writeback); - writeback->allocate(); - memcpy(writeback->getPtr<uint8_t>(), tag_ptr->data, blkSize); + Request *writebackReq = new Request(regenerateBlkAddr(tag_ptr->tag, 0), + blkSize, 0, Request::wbMasterId); + PacketPtr writeback = new Packet(writebackReq, MemCmd::Writeback); + writeback->allocate(); + memcpy(writeback->getPtr<uint8_t>(), tag_ptr->data, blkSize); - writebacks.push_back(writeback); - } + writebacks.push_back(writeback); } // free the data blocks diff --git a/src/mem/ruby/system/Sequencer.cc b/src/mem/ruby/system/Sequencer.cc index c48ff59cf..efb0b002e 100644 --- a/src/mem/ruby/system/Sequencer.cc +++ b/src/mem/ruby/system/Sequencer.cc @@ -645,8 +645,9 @@ Sequencer::makeRequest(PacketPtr pkt) void Sequencer::issueRequest(PacketPtr pkt, RubyRequestType secondary_type) { + assert(pkt != NULL); int proc_id = -1; - if (pkt != NULL && pkt->req->hasContextId()) { + if (pkt->req->hasContextId()) { proc_id = pkt->req->contextId(); } |