drm/amdgpu/vcn: fix unitialized variable warnings
authorPierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Thu, 18 Apr 2024 18:06:08 +0000 (20:06 +0200)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 23 Apr 2024 16:08:30 +0000 (12:08 -0400)
Avoid returning an uninitialized value if we never enter the loop.
This case should never be hit in practice, but returning 0 doesn't
hurt.

The same fix is applied to the 4 places using the same pattern.

v2: - fixed typos in commit message (Alex)
    - use "return 0;" before the done label instead of initializing
      r to 0

Signed-off-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c
drivers/gpu/drm/amd/amdgpu/vcn_v4_0.c
drivers/gpu/drm/amd/amdgpu/vcn_v4_0_5.c
drivers/gpu/drm/amd/amdgpu/vcn_v5_0_0.c

index 8f82fb887e9c20c293b1390bb90c58ea9ff8ceea..26e63f01250a6106c62bca8292ddb33802f61d08 100644 (file)
@@ -359,6 +359,7 @@ static int vcn_v3_0_hw_init(void *handle)
                }
        }
 
+       return 0;
 done:
        if (!r)
                DRM_INFO("VCN decode and encode initialized successfully(under %s).\n",
index 832d15f7b5f61c0f22a3bf7779cca8108e0087e4..aff1a4d8d393602f3707f172b9aed4ed61204dc1 100644 (file)
@@ -288,6 +288,7 @@ static int vcn_v4_0_hw_init(void *handle)
                }
        }
 
+       return 0;
 done:
        if (!r)
                DRM_INFO("VCN decode and encode initialized successfully(under %s).\n",
index 501e53e69f2a0ca94076cd5616fbea1646ca4af1..8f2bcce13339237e0429a88e861ab6a4e47ff836 100644 (file)
@@ -237,6 +237,7 @@ static int vcn_v4_0_5_hw_init(void *handle)
                        goto done;
        }
 
+       return 0;
 done:
        if (!r)
                DRM_INFO("VCN decode and encode initialized successfully(under %s).\n",
index bc60c554eb32960e166833d899094dbbb3442ad0..b226306164bcd6d0e18e7e0267c7906b83dc0c95 100644 (file)
@@ -203,6 +203,7 @@ static int vcn_v5_0_0_hw_init(void *handle)
                        goto done;
        }
 
+       return 0;
 done:
        if (!r)
                DRM_INFO("VCN decode and encode initialized successfully(under %s).\n",