]> www.infradead.org Git - users/hch/misc.git/commitdiff
drm/xe/sysfs: Add cleanup action in xe_device_sysfs_init
authorZongyao Bai <zongyao.bai@intel.com>
Mon, 15 Sep 2025 21:47:15 +0000 (05:47 +0800)
committerLucas De Marchi <lucas.demarchi@intel.com>
Tue, 16 Sep 2025 14:59:36 +0000 (07:59 -0700)
On partial failure, some sysfs files created before the failure might
not be removed. Add common cleanup step to remove them all immediately,
as is should be harmless to attempt to remove non-existing files.

Fixes: 0e414bf7ad01 ("drm/xe: Expose PCIe link downgrade attributes")
Cc: Lucas De Marchi <lucas.demarchi@intel.com>
Cc: Stuart Summers <stuart.summers@intel.com>
Cc: Shuicheng Lin <shuicheng.lin@intel.com>
Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
Signed-off-by: Zongyao Bai <zongyao.bai@intel.com>
Reviewed-by: Shuicheng Lin <shuicheng.lin@intel.com>
Reviewed-by: Lucas De Marchi <lucas.demarchi@intel.com>
Link: https://lore.kernel.org/r/20250915214716.1327379-2-zongyao.bai@intel.com
Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
drivers/gpu/drm/xe/xe_device_sysfs.c

index 6ee422594b5647978d99c0c4a8e4a06d190bfa8a..b7f8fcfed8d860ca00a45e8796d4e1d3349265ef 100644 (file)
@@ -311,12 +311,16 @@ int xe_device_sysfs_init(struct xe_device *xe)
        if (xe->info.platform == XE_BATTLEMAGE) {
                ret = sysfs_create_files(&dev->kobj, auto_link_downgrade_attrs);
                if (ret)
-                       return ret;
+                       goto cleanup;
 
                ret = late_bind_create_files(dev);
                if (ret)
-                       return ret;
+                       goto cleanup;
        }
 
        return devm_add_action_or_reset(dev, xe_device_sysfs_fini, xe);
+
+cleanup:
+       xe_device_sysfs_fini(xe);
+       return ret;
 }