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

Wang, Yang(Kevin) KevinYang.Wang at amd.com
Tue May 28 07:19:11 UTC 2024


[AMD Official Use Only - AMD Internal Distribution Only]

Hi SRINIVASAN,

Please pause this patch.
The original intention of the patch was to avoid creating an empty directory ("gpu_od") , as this change may result in incorrect results.

Thanks.

Best Regards,
Kevin

-----Original Message-----
From: SHANMUGAM, SRINIVASAN <SRINIVASAN.SHANMUGAM at amd.com>
Sent: Tuesday, May 28, 2024 2:53 PM
To: Koenig, Christian <Christian.Koenig at amd.com>; Deucher, Alexander <Alexander.Deucher at amd.com>
Cc: amd-gfx at lists.freedesktop.org; SHANMUGAM, SRINIVASAN <SRINIVASAN.SHANMUGAM at amd.com>; Ma, Jun <Jun.Ma2 at amd.com>; Wang, Yang(Kevin) <KevinYang.Wang at amd.com>; Lazar, Lijo <Lijo.Lazar at amd.com>
Subject: [PATCH] drm/amdgpu: Fix missing error code in amdgpu_od_set_init

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