Skip to contentSkip to conversation

drm/amdgpu: init return value in amdgpu_ttm_clear_buffer

PATCH In review Pierre-Eric Pelloux-Prayer 3 participants 4 messages Feb 21, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amdgpu: init return value in amdgpu_ttm_clear_buffer

Otherwise an uninitialized value can be returned if amdgpu_res_cleared returns true for all regions.

Fixes a68c7eaa7a8f ("drm/amdgpu: Enable clear page functionality")
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +1 -1
index a30985c8f539..e8d7c23f22c6 100644
@@ -2295,7 +2295,7 @@ int amdgpu_ttm_clear_buffer(struct amdgpu_bo *bo,
 	struct amdgpu_ring *ring = adev->mman.buffer_funcs_ring;
 	struct amdgpu_res_cursor cursor;
 	u64 addr;
-	int r;
+	int r = 0;
 
 	if (!adev->mman.buffer_funcs_enabled)
 		return -EINVAL;
Signature · 1 line
2.43.0
Acked-by on v1 1/1
#1 lore raw
Quoted 6 lines · Pierre-Eric Pelloux-Prayer

Otherwise an uninitialized value can be returned if amdgpu_res_cleared returns true for all regions.

Fixes a68c7eaa7a8f ("drm/amdgpu: Enable clear page functionality")
Quoted 20 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +1 -2
index a30985c8f539..e8d7c23f22c6 100644
@@ -2295,7 +2295,7 @@ int amdgpu_ttm_clear_buffer(struct amdgpu_bo *bo,
        struct amdgpu_ring *ring = adev->mman.buffer_funcs_ring;
        struct amdgpu_res_cursor cursor;
        u64 addr;
-       int r;
+       int r = 0;
 
        if (!adev->mman.buffer_funcs_enabled)
                return -EINVAL;
--

2.43.0

maintainer Reviewed-by
#2 lore raw

Am 21.02.25 um 16:16 schrieb Alex Deucher:

Quoted 8 lines
Quoted 5 lines · Pierre-Eric Pelloux-Prayer

Otherwise an uninitialized value can be returned if amdgpu_res_cleared returns true for all regions.

Fixes a68c7eaa7a8f ("drm/amdgpu: Enable clear page functionality")
Quoted 21 lines
Quoted 21 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +1 -2
index a30985c8f539..e8d7c23f22c6 100644
@@ -2295,7 +2295,7 @@ int amdgpu_ttm_clear_buffer(struct amdgpu_bo *bo,
        struct amdgpu_ring *ring = adev->mman.buffer_funcs_ring;
        struct amdgpu_res_cursor cursor;
        u64 addr;
-       int r;
+       int r = 0;
 
        if (!adev->mman.buffer_funcs_enabled)
                return -EINVAL;
--

2.43.0

#3 lore raw
In reply to Pierre-Eric Pelloux-Prayer
Quoted 5 lines · Pierre-Eric Pelloux-Prayer

Otherwise an uninitialized value can be returned if amdgpu_res_cleared returns true for all regions.

Fixes a68c7eaa7a8f ("drm/amdgpu: Enable clear page functionality")

Possibly closes: https://gitlab.freedesktop.org/drm/amd/-/issues/3812

Quoted 21 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +1 -2
index a30985c8f539..e8d7c23f22c6 100644
@@ -2295,7 +2295,7 @@ int amdgpu_ttm_clear_buffer(struct amdgpu_bo *bo,
        struct amdgpu_ring *ring = adev->mman.buffer_funcs_ring;
        struct amdgpu_res_cursor cursor;
        u64 addr;
-       int r;
+       int r = 0;
 
        if (!adev->mman.buffer_funcs_enabled)
                return -EINVAL;
--

2.43.0