drm/amdgpu/pm: Remove gpu_od if it's an empty directory
authorMa Jun <Jun.Ma2@amd.com>
Tue, 16 Apr 2024 09:30:12 +0000 (17:30 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 23 Apr 2024 16:08:30 +0000 (12:08 -0400)
gpu_od should be removed if it's an empty directory

Signed-off-by: Ma Jun <Jun.Ma2@amd.com>
Reported-by: Yang Wang <kevinyang.wang@amd.com>
Reviewed-by: Yang Wang <kevinyang.wang@amd.com>
Suggested-by: Lijo Lazar <lijo.lazar@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/pm/amdgpu_pm.c

index 5bc1cd4993e8a52d2798992ab7b0abfb59a6d3e7..569bc6e61b77aef31a946960b4e0bd804d6d3cd9 100644 (file)
@@ -4338,6 +4338,13 @@ 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))
+               goto err_out;
+
        return 0;
 
 err_out: