SWDEV-306940 - Fix hip errors/warnings by CppCheck (#2486)

Change-Id: I91f5e97b0c7ca80b6d21fa66d24e3cf9fde716a9

[ROCm/hip-tests commit: 833e962ddd]
This commit is contained in:
Satyanvesh Dittakavi
2022-02-24 20:57:04 +05:30
committed by GitHub
parent 750df46bf8
commit 4e9ddeee7d
7 changed files with 16 additions and 22 deletions
@@ -48,17 +48,14 @@ __global__ void incrementKernel(int32_t* in, int32_t* out, int32_t value, size_t
int main() {
int32_t incrementValue = 10;
// Host pointers
int32_t* hInput = nullptr;
int32_t* hOutput = nullptr;
// Device pointers
int32_t* dInput = nullptr;
int32_t* dOutput = nullptr;
size_t NBytes = SIZE * sizeof(int32_t);
hInput = static_cast<int32_t*>(malloc(NBytes));
hOutput = static_cast<int32_t*>(malloc(NBytes));
// Host pointers
int32_t* hInput = static_cast<int32_t*>(malloc(NBytes));
int32_t* hOutput = static_cast<int32_t*>(malloc(NBytes));
HIP_STATUS_CHECK(hipMalloc(&dInput, NBytes));
HIP_STATUS_CHECK(hipMalloc(&dOutput, NBytes));
@@ -95,4 +92,4 @@ int main() {
std::cout << "success\n";
}
return 0;
}
}
@@ -58,8 +58,8 @@ void run_test2() {
HIP_ASSERT(hipFree(A_d));
HIP_ASSERT(hipFree(B_d));
free(A_h);
free(B_h);
delete [] A_h;
delete [] B_h;
std::cout << "Test Passed!\n";
}