aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMa Jun <Jun.Ma2@amd.com>2024-04-16 17:30:12 +0800
committerAlex Deucher <alexander.deucher@amd.com>2024-04-23 23:22:46 -0400
commit0e95ed6452cb079cf9587c774a475a7d83c7e040 (patch)
tree8be9dd4d554ef75d3b012d6c1f807d7a951434bc
parent9c783a11214553a54f0915a7260a3ce624d36bf2 (diff)
downloadlinux-0e95ed6452cb079cf9587c774a475a7d83c7e040.tar.gz
drm/amdgpu/pm: Remove gpu_od if it's an empty directory
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
-rw-r--r--drivers/gpu/drm/amd/pm/amdgpu_pm.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/pm/amdgpu_pm.c b/drivers/gpu/drm/amd/pm/amdgpu_pm.c
index f09b9d49297e81..bbd0169010c2d5 100644
--- a/drivers/gpu/drm/amd/pm/amdgpu_pm.c
+++ b/drivers/gpu/drm/amd/pm/amdgpu_pm.c
@@ -4261,6 +4261,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: