Initialize 'r' to 0 so the function does not return an uninitialized
value when the while loop body is never entered. Current callers always
supply non-zero sized BOs so the loop always executes, but the function
itself does not enforce this and static analysis tools flag the
potential use.
Fixes: 22f7cc752408 ("drm/amdgpu: restructure amdgpu_fill_buffer v2")
Signed-off-by: Samasth Norway Ananda <[email protected]>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
index 15d561e3d87f..44524eb2f74f 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
@@ -2564,7 +2564,7 @@ int amdgpu_fill_buffer(struct amdgpu_ttm_buffer_entity
*entity,
struct amdgpu_device *adev = amdgpu_ttm_adev(bo->tbo.bdev);
struct dma_fence *fence = NULL;
struct amdgpu_res_cursor dst;
- int r;
+ int r = 0;
if (!adev->mman.buffer_funcs_enabled) {
dev_err(adev->dev,
--
2.50.1