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
This commit is contained in:
parent
9ad7e23e9e
commit
292d8252a4
2 changed files with 18 additions and 18 deletions
33
src/mem/cache/tags/iic.cc
vendored
33
src/mem/cache/tags/iic.cc
vendored
|
@ -352,33 +352,32 @@ IIC::freeReplacementBlock(PacketList & writebacks)
|
||||||
unsigned long data_ptr;
|
unsigned long data_ptr;
|
||||||
/* consult replacement policy */
|
/* consult replacement policy */
|
||||||
tag_ptr = &tagStore[repl->getRepl()];
|
tag_ptr = &tagStore[repl->getRepl()];
|
||||||
|
assert(tag_ptr != NULL);
|
||||||
assert(tag_ptr->isValid());
|
assert(tag_ptr->isValid());
|
||||||
|
|
||||||
DPRINTF(Cache, "Replacing %x in IIC: %s\n",
|
DPRINTF(Cache, "Replacing %x in IIC: %s\n",
|
||||||
regenerateBlkAddr(tag_ptr->tag,0),
|
regenerateBlkAddr(tag_ptr->tag,0),
|
||||||
tag_ptr->isDirty() ? "writeback" : "clean");
|
tag_ptr->isDirty() ? "writeback" : "clean");
|
||||||
/* write back replaced block data */
|
/* write back replaced block data */
|
||||||
if (tag_ptr && (tag_ptr->isValid())) {
|
replacements[0]++;
|
||||||
replacements[0]++;
|
totalRefs += tag_ptr->refCount;
|
||||||
totalRefs += tag_ptr->refCount;
|
++sampledRefs;
|
||||||
++sampledRefs;
|
tag_ptr->refCount = 0;
|
||||||
tag_ptr->refCount = 0;
|
|
||||||
|
|
||||||
if (tag_ptr->isDirty()) {
|
if (tag_ptr->isDirty()) {
|
||||||
/* PacketPtr writeback =
|
/* PacketPtr writeback =
|
||||||
buildWritebackReq(regenerateBlkAddr(tag_ptr->tag, 0),
|
buildWritebackReq(regenerateBlkAddr(tag_ptr->tag, 0),
|
||||||
tag_ptr->req->asid, tag_ptr->xc, blkSize,
|
tag_ptr->req->asid, tag_ptr->xc, blkSize,
|
||||||
tag_ptr->data,
|
tag_ptr->data,
|
||||||
tag_ptr->size);
|
tag_ptr->size);
|
||||||
*/
|
*/
|
||||||
Request *writebackReq = new Request(regenerateBlkAddr(tag_ptr->tag, 0),
|
Request *writebackReq = new Request(regenerateBlkAddr(tag_ptr->tag, 0),
|
||||||
blkSize, 0, Request::wbMasterId);
|
blkSize, 0, Request::wbMasterId);
|
||||||
PacketPtr writeback = new Packet(writebackReq, MemCmd::Writeback);
|
PacketPtr writeback = new Packet(writebackReq, MemCmd::Writeback);
|
||||||
writeback->allocate();
|
writeback->allocate();
|
||||||
memcpy(writeback->getPtr<uint8_t>(), tag_ptr->data, blkSize);
|
memcpy(writeback->getPtr<uint8_t>(), tag_ptr->data, blkSize);
|
||||||
|
|
||||||
writebacks.push_back(writeback);
|
writebacks.push_back(writeback);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// free the data blocks
|
// free the data blocks
|
||||||
|
|
|
@ -645,8 +645,9 @@ Sequencer::makeRequest(PacketPtr pkt)
|
||||||
void
|
void
|
||||||
Sequencer::issueRequest(PacketPtr pkt, RubyRequestType secondary_type)
|
Sequencer::issueRequest(PacketPtr pkt, RubyRequestType secondary_type)
|
||||||
{
|
{
|
||||||
|
assert(pkt != NULL);
|
||||||
int proc_id = -1;
|
int proc_id = -1;
|
||||||
if (pkt != NULL && pkt->req->hasContextId()) {
|
if (pkt->req->hasContextId()) {
|
||||||
proc_id = pkt->req->contextId();
|
proc_id = pkt->req->contextId();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue