fmm.c: Fix possibly initialized variable usage

If we end up in the first if clause, aperture_base is not set, unlike
the other 2 clauses. Initialize it to NULL at declaration time, and only
change its value in the final else clause, where we set it to
aperture->base

Change-Id: I2bf44dc93cae8a03e66f41cedd85d57be2115bba
Signed-off-by: Kent Russell <kent.russell@amd.com>
This commit is contained in:
Kent Russell
2023-05-30 15:43:36 -04:00
parent f6183f937e
commit 718d95de77
+1 -2
View File
@@ -3552,7 +3552,7 @@ HSAKMT_STATUS fmm_register_graphics_handle(HSAuint64 GraphicsResourceHandle,
HsaMemFlags mflags;
vm_object_t *obj;
void *metadata;
void *mem, *aperture_base;
void *mem, *aperture_base = NULL;
int32_t gpu_mem_id;
int r;
HSAKMT_STATUS status = HSAKMT_STATUS_ERROR;
@@ -3591,7 +3591,6 @@ HSAKMT_STATUS fmm_register_graphics_handle(HSAuint64 GraphicsResourceHandle,
aperture = &mem_handle_aperture;
} else if (topology_is_svm_needed(gpu_mem[gpu_mem_id].EngineId)) {
aperture = svm.dgpu_aperture;
aperture_base = NULL;
} else {
aperture = &gpu_mem[gpu_mem_id].gpuvm_aperture;
aperture_base = aperture->base;