Re: [PATCH] drm/amdgpu: fix some uninitialized variables

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Am 24.04.24 um 03:19 schrieb Jesse Zhang:
Fix some variables not initialized before use.
Scan them out using Synopsys tools.

Signed-off-by: Jesse Zhang <Jesse.Zhang@xxxxxxx>
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c | 2 +-
  drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 5 +++++
  drivers/gpu/drm/amd/amdgpu/atom.c       | 1 +
  drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c  | 3 ++-
  drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c  | 3 ++-
  drivers/gpu/drm/amd/amdgpu/sdma_v6_0.c  | 3 ++-
  6 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c
index 59acf424a078..60d97cd14855 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c
@@ -742,7 +742,7 @@ int amdgpu_vce_ring_parse_cs(struct amdgpu_cs_parser *p,
  	uint32_t destroyed = 0;
  	uint32_t created = 0;
  	uint32_t allocated = 0;
-	uint32_t tmp, handle = 0;
+	uint32_t tmp = 0, handle = 0;

As far as I can see that isn't correct. tmp isn't used before it is written.

Is the tool maybe broken?

Regards,
Christian.

  	uint32_t *size = &tmp;
  	unsigned int idx;
  	int i, r = 0;
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c
index 677eb141554e..13125ddd5e86 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c
@@ -410,6 +410,11 @@ static void amdgpu_vcn_idle_work_handler(struct work_struct *work)
  			else
  				new_state.fw_based = VCN_DPG_STATE__UNPAUSE;
+ if (amdgpu_fence_count_emitted(adev->jpeg.inst->ring_dec))
+				new_state.jpeg = VCN_DPG_STATE__PAUSE;
+			else
+				new_state.jpeg = VCN_DPG_STATE__UNPAUSE;
+
  			adev->vcn.pause_dpg_mode(adev, j, &new_state);
  		}
diff --git a/drivers/gpu/drm/amd/amdgpu/atom.c b/drivers/gpu/drm/amd/amdgpu/atom.c
index 72362df352f6..d552e013354c 100644
--- a/drivers/gpu/drm/amd/amdgpu/atom.c
+++ b/drivers/gpu/drm/amd/amdgpu/atom.c
@@ -1243,6 +1243,7 @@ static int amdgpu_atom_execute_table_locked(struct atom_context *ctx, int index,
  	ectx.ps_size = params_size;
  	ectx.abort = false;
  	ectx.last_jump = 0;
+	ectx.last_jump_jiffies = 0;
  	if (ws) {
  		ectx.ws = kcalloc(4, ws, GFP_KERNEL);
  		ectx.ws_size = ws;
diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c b/drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c
index 45a2d0a5a2d7..b7d33d78bce0 100644
--- a/drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c
@@ -999,7 +999,8 @@ static int sdma_v5_0_ring_test_ring(struct amdgpu_ring *ring)
  	r = amdgpu_ring_alloc(ring, 20);
  	if (r) {
  		DRM_ERROR("amdgpu: dma failed to lock ring %d (%d).\n", ring->idx, r);
-		amdgpu_device_wb_free(adev, index);
+		if (!ring->is_mes_queue)
+			amdgpu_device_wb_free(adev, index);
  		return r;
  	}
diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c b/drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c
index 43e64b2da575..cc9e961f0078 100644
--- a/drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c
+++ b/drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c
@@ -839,7 +839,8 @@ static int sdma_v5_2_ring_test_ring(struct amdgpu_ring *ring)
  	r = amdgpu_ring_alloc(ring, 20);
  	if (r) {
  		DRM_ERROR("amdgpu: dma failed to lock ring %d (%d).\n", ring->idx, r);
-		amdgpu_device_wb_free(adev, index);
+		if (!ring->is_mes_queue)
+			amdgpu_device_wb_free(adev, index);
  		return r;
  	}
diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v6_0.c b/drivers/gpu/drm/amd/amdgpu/sdma_v6_0.c
index 1f4877195213..c833b6b8373b 100644
--- a/drivers/gpu/drm/amd/amdgpu/sdma_v6_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/sdma_v6_0.c
@@ -861,7 +861,8 @@ static int sdma_v6_0_ring_test_ring(struct amdgpu_ring *ring)
  	r = amdgpu_ring_alloc(ring, 5);
  	if (r) {
  		DRM_ERROR("amdgpu: dma failed to lock ring %d (%d).\n", ring->idx, r);
-		amdgpu_device_wb_free(adev, index);
+		if (!ring->is_mes_queue)
+			amdgpu_device_wb_free(adev, index);
  		return r;
  	}




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux