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:
Andreas Hansson 2012-09-11 14:15:47 -04:00
parent 9ad7e23e9e
commit 292d8252a4
2 changed files with 18 additions and 18 deletions

View file

@ -352,13 +352,13 @@ 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;
@ -379,7 +379,6 @@ IIC::freeReplacementBlock(PacketList & writebacks)
writebacks.push_back(writeback);
}
}
// free the data blocks
for (int i = 0; i < tag_ptr->numData; ++i) {

View file

@ -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();
}