Skip to contentSkip to conversation

drm/amdgpu/vcn: Fix sysfs cleanup in vcn_v4_0_5_sw_fini

PATCH New Yong Jie Wong 1 participant 1 message Nov 4, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amdgpu/vcn: Fix sysfs cleanup in vcn_v4_0_5_sw_fini

Add missing amdgpu_vcn_sysfs_reset_mask_fini() call to properly clean up the vcn_reset_mask sysfs file during driver unload. Without this cleanup, subsequent driver reloads fail with "sysfs: cannot create duplicate filename" errors.

The vcn_v4_0_5 driver creates the vcn_reset_mask sysfs file in vcn_v4_0_5_sw_init() via amdgpu_vcn_sysfs_reset_mask_init(), but was missing the corresponding amdgpu_vcn_sysfs_reset_mask_fini() call in vcn_v4_0_5_sw_fini(). This left the sysfs file orphaned after driver unload, causing -EEXIST errors on reload.

Error without fix:
sysfs: cannot create duplicate filename '/devices/.../vcn_reset_mask'

  amdgpu_vcn_sysfs_reset_mask_init+0x2c/0x40 [amdgpu]
  vcn_v4_0_5_sw_init+0x2d6/0x480 [amdgpu]
  [drm:amdgpu_device_ip_init [amdgpu]] *ERROR* sw_init of IP block
  <vcn_v4_0_5> failed -17
---
 drivers/gpu/drm/amd/amdgpu/vcn_v4_0_5.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/vcn_v4_0_5.c +4 -1
index b107ee80e4728..cd26d45845322 100644
@@ -269,9 +269,12 @@ static int vcn_v4_0_5_sw_fini(struct amdgpu_ip_block *ip_block)
 		r = amdgpu_vcn_suspend(adev, i);
 		if (r)
 			return r;
+	}
+
+	amdgpu_vcn_sysfs_reset_mask_fini(adev);
 
+	for (i = 0; i < adev->vcn.num_vcn_inst; i++)
 		amdgpu_vcn_sw_fini(adev, i);
-	}
 
 	return 0;
 }
Signature · 1 line
2.43.0