On 4/22/2024 7:25 PM, Christian König wrote: > Am 22.04.24 um 11:49 schrieb Ma Jun: >> Initialize the variables which were not initialized >> to fix the coverity issue "Uninitialized scalar variable" > > Feel free to add my Acked-by to the first two patches, but this here > clearly doesn't looks like a good idea to me. > >> >> Signed-off-by: Ma Jun <Jun.Ma2@xxxxxxx> >> --- >> drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c | 2 +- >> drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 2 +- >> drivers/gpu/drm/amd/amdgpu/amdgpu_xcp.c | 2 +- >> 3 files changed, 3 insertions(+), 3 deletions(-) >> >> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c >> index 7e6d09730e6d..7b28b6b8982b 100644 >> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c >> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c >> @@ -437,7 +437,7 @@ void amdgpu_irq_dispatch(struct amdgpu_device *adev, >> struct amdgpu_ih_ring *ih) >> { >> u32 ring_index = ih->rptr >> 2; >> - struct amdgpu_iv_entry entry; >> + struct amdgpu_iv_entry entry = {0}; > > When this needs to be initialized there is clearly something wrong with > the code. I would guess similar for the other two. > Yes. Some decode_iv functions did't assign value to entry.timestamp. I will check this. > What exactly does coverity complains about? Coverity warning: Using uninitialized value entry.timestamp > > Regards, > Christian. > >> unsigned int client_id, src_id; >> struct amdgpu_irq_src *src; >> bool handled = false; >> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c >> index 924baf58e322..f0a63d084b4d 100644 >> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c >> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c >> @@ -1559,7 +1559,7 @@ static int amdgpu_debugfs_firmware_info_show(struct seq_file *m, void *unused) >> { >> struct amdgpu_device *adev = m->private; >> struct drm_amdgpu_info_firmware fw_info; >> - struct drm_amdgpu_query_fw query_fw; >> + struct drm_amdgpu_query_fw query_fw = {0}; Coverity warning: uninit_use_in_call Using uninitialized value query_fw.index when calling amdgpu_firmware_info Even though qeuery_fw.index was assigned a value before it's used, there is still an coverity warning. We need to initialize query_fw when declare it. >> struct atom_context *ctx = adev->mode_info.atom_context; >> uint8_t smu_program, smu_major, smu_minor, smu_debug; >> int ret, i; >> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_xcp.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_xcp.c >> index 2b99eed5ba19..41ac3319108b 100644 >> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_xcp.c >> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_xcp.c >> @@ -120,7 +120,7 @@ static void __amdgpu_xcp_add_block(struct amdgpu_xcp_mgr *xcp_mgr, int xcp_id, >> int amdgpu_xcp_init(struct amdgpu_xcp_mgr *xcp_mgr, int num_xcps, int mode) >> { >> struct amdgpu_device *adev = xcp_mgr->adev; >> - struct amdgpu_xcp_ip ip; >> + struct amdgpu_xcp_ip ip = {0}; Coverity Warning: Using uninitialized value ip. Field ip.valid is uninitialized when calling __amdgpu_xcp_add_block The code is ok. We just need to initialize the variable ip. Regards, Ma Jun >> uint8_t mem_id; >> int i, j, ret; >> >