drm/amdgpu: reset psp->cmd to NULL after releasing the buffer
authorJiang Liu <gerry@linux.alibaba.com>
Fri, 7 Feb 2025 06:28:49 +0000 (14:28 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 13 Feb 2025 02:04:08 +0000 (21:04 -0500)
Reset psp->cmd to NULL after releasing the buffer in function psp_sw_fini().

Reviewed-by: Lijo Lazar <lijo.lazar@amd.com>
Signed-off-by: Jiang Liu <gerry@linux.alibaba.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c

index c609c96a999d564c02b40aafc17b701755b9d3a2..48b55dae624123c6724bfab48449f0bbe9289190 100644 (file)
@@ -541,7 +541,6 @@ static int psp_sw_fini(struct amdgpu_ip_block *ip_block)
 {
        struct amdgpu_device *adev = ip_block->adev;
        struct psp_context *psp = &adev->psp;
-       struct psp_gfx_cmd_resp *cmd = psp->cmd;
 
        psp_memory_training_fini(psp);
 
@@ -551,8 +550,8 @@ static int psp_sw_fini(struct amdgpu_ip_block *ip_block)
        amdgpu_ucode_release(&psp->cap_fw);
        amdgpu_ucode_release(&psp->toc_fw);
 
-       kfree(cmd);
-       cmd = NULL;
+       kfree(psp->cmd);
+       psp->cmd = NULL;
 
        psp_free_shared_bufs(psp);