rocr: multiple uninitialized and unused variables

Minor modifications to multiple source and header
files based on Coverity report

Change-Id: I4a73d0f56640983c4d5124e13c8c280245cca672
Signed-off-by: Apurv Mishra <apurv.mishra@amd.com>


[ROCm/ROCR-Runtime commit: 699d0140be]
This commit is contained in:
Apurv Mishra
2024-12-16 16:00:08 -05:00
parent 2f2cb50cf2
commit 23ab95b5f2
9 changed files with 16 additions and 12 deletions
@@ -61,7 +61,7 @@ class ScratchCache {
bool large;
uint32_t state;
node() : base(nullptr), state(FREE) {}
node() : base(nullptr), large(false), state(FREE) {}
bool isFree() const { return state == FREE; }
bool trimPending() const { return state == (ALLOC | TRIM); }
@@ -90,7 +90,11 @@ struct SharedSignal {
uint64_t sdma_end_ts;
uint8_t reserved2[24];
SharedSignal() {
SharedSignal() :
sdma_start_ts(0),
reserved{},
sdma_end_ts(0),
reserved2{} {
memset(&amd_signal, 0, sizeof(amd_signal));
amd_signal.kind = AMD_SIGNAL_KIND_INVALID;
core_signal = nullptr;
@@ -137,10 +137,8 @@ int32_t RvdFilter::ProcessUuidToken(const std::string& token) {
uint32_t uuidLen = devUuidList_[idx].length();
// Token could match UUID of another device
if (tokenLen > uuidLen) {
compareVal = -1;
if (tokenLen > uuidLen)
continue;
}
// Token could match as substring of device UUID
compareVal = token.compare(0, tokenLen, devUuidList_[idx], 0, tokenLen);
@@ -474,11 +474,11 @@ hsa_status_t MemoryRegion::AllowAccess(uint32_t num_agents,
// Adjust for fragments. Make accessibility sticky for fragments since this will satisfy the
// union of accessible agents between the fragments in the block.
hsa_amd_pointer_info_t info;
hsa_amd_pointer_info_t info = {};
uint32_t agent_count = 0;
hsa_agent_t* accessible = nullptr;
MAKE_SCOPE_GUARD([&]() { free(accessible); });
core::Runtime::PtrInfoBlockData blockInfo;
core::Runtime::PtrInfoBlockData blockInfo = {};
std::vector<uint64_t> union_agents;
info.size = sizeof(info);
@@ -96,7 +96,7 @@ hsa_signal_value_t BusyWaitSignal::WaitRelaxed(hsa_signal_condition_t condition,
// Should be a few times bigger than null kernel latency
const timer::fast_clock::duration kMaxElapsed = std::chrono::microseconds(200);
uint64_t hsa_freq;
uint64_t hsa_freq = 0;
HSA::hsa_system_get_info(HSA_SYSTEM_INFO_TIMESTAMP_FREQUENCY, &hsa_freq);
const timer::fast_clock::duration fast_timeout =
timer::duration_from_seconds<timer::fast_clock::duration>(
@@ -170,7 +170,7 @@ hsa_signal_value_t InterruptSignal::WaitRelaxed(
// Should be a few times bigger than null kernel latency
const timer::fast_clock::duration kMaxElapsed = std::chrono::microseconds(200);
uint64_t hsa_freq;
uint64_t hsa_freq = 0;
HSA::hsa_system_get_info(HSA_SYSTEM_INFO_TIMESTAMP_FREQUENCY, &hsa_freq);
const timer::fast_clock::duration fast_timeout =
timer::duration_from_seconds<timer::fast_clock::duration>(
@@ -245,7 +245,7 @@ uint32_t Signal::WaitAny(uint32_t signal_count, const hsa_signal_t* hsa_signals,
const timer::fast_clock::duration kMaxElapsed = std::chrono::microseconds(200);
// Convert timeout value into the fast_clock domain
uint64_t hsa_freq;
uint64_t hsa_freq = 0;
HSA::hsa_system_get_info(HSA_SYSTEM_INFO_TIMESTAMP_FREQUENCY, &hsa_freq);
const timer::fast_clock::duration fast_timeout =
timer::duration_from_seconds<timer::fast_clock::duration>(
@@ -891,6 +891,8 @@ namespace elf {
GElfSection::GElfSection(GElfImage* elf_)
: elf(elf_),
seg(nullptr),
hdr{},
memsize_(0),
align_(0),
reloc_sec(nullptr),
@@ -1020,7 +1022,6 @@ namespace elf {
if (coffset <= offset && offset <= coffset + edata->d_size) {
csize = (std::min)(size, edata->d_size - offset);
memcpy(dest, (const char*) edata->d_buf + offset - coffset, csize);
coffset += csize;
dest = (char*) dest + csize;
size -= csize;
if (!size) { return true; }
@@ -161,7 +161,8 @@ public:
, is_dynamic_callstack(_is_dynamic_callstack)
, size(_size)
, alignment(_alignment)
, wavefront_size(_wavefront_size) {}
, wavefront_size(_wavefront_size)
, debug_info{} {}
~KernelSymbol() {}