]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 2 May 2024 14:35:29 +0000 (16:35 +0200)
commit 0e95ed6452cb079cf9587c774a475a7d83c7e040 upstream.

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>
Cc: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/gpu/drm/amd/pm/amdgpu_pm.c

index 39c5e1dfa275a64f32fa358d875efc6d0bd99682..b4698f98560061e01e5bfddd4c6a066c79c0ffba 100644 (file)
@@ -4217,6 +4217,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: