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@xxxxxxx> Cc: Yang Wang <kevinyang.wang@xxxxxxx> Cc: Lijo Lazar <lijo.lazar@xxxxxxx> Cc: Alex Deucher <alexander.deucher@xxxxxxx> Cc: Christian König <christian.koenig@xxxxxxx> Signed-off-by: Srinivasan Shanmugam <srinivasan.shanmugam@xxxxxxx> --- 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