[PATCH] drm/amdgpu: Fix missing error code in amdgpu_od_set_init

Srinivasan Shanmugam srinivasan.shanmugam at amd.com
Tue May 28 06:53:16 UTC 2024


This commit ensures that an error code -EINVAL is set in the
amdgpu_od_set_init function when the od_kobj_list has only one entry,
indicating that the list is not in the expected state.

Fixes the below:
drivers/gpu/drm/amd/amdgpu/../pm/amdgpu_pm.c:4355 amdgpu_od_set_init() warn: missing error code 'ret'

Fixes: d9a3a5e770dc ("drm/amdgpu/pm: Remove gpu_od if it's an empty directory")
Cc: Ma Jun <Jun.Ma2 at amd.com>
Cc: Yang Wang <kevinyang.wang at amd.com>
Cc: Lijo Lazar <lijo.lazar at amd.com>
Cc: Alex Deucher <alexander.deucher at amd.com>
Cc: Christian König <christian.koenig at amd.com>
Signed-off-by: Srinivasan Shanmugam <srinivasan.shanmugam at amd.com>
---
 drivers/gpu/drm/amd/pm/amdgpu_pm.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/pm/amdgpu_pm.c b/drivers/gpu/drm/amd/pm/amdgpu_pm.c
index d5d6ab484e5a..86118fbfc33c 100644
--- a/drivers/gpu/drm/amd/pm/amdgpu_pm.c
+++ b/drivers/gpu/drm/amd/pm/amdgpu_pm.c
@@ -4463,8 +4463,10 @@ static int amdgpu_od_set_init(struct amdgpu_device *adev)
 	 * If gpu_od is the only member in the list, that means gpu_od is an
 	 * empty directory, so remove it.
 	 */
-	if (list_is_singular(&adev->pm.od_kobj_list))
+	if (list_is_singular(&adev->pm.od_kobj_list)) {
+		ret = -EINVAL;
 		goto err_out;
+	}
 
 	return 0;
 
-- 
2.34.1



More information about the amd-gfx mailing list