]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
drm/xe: Fix freq kobject leak on sysfs_create_files failure
authorShuicheng Lin <shuicheng.lin@intel.com>
Fri, 14 Nov 2025 20:56:39 +0000 (20:56 +0000)
committerThomas Hellström <thomas.hellstrom@linux.intel.com>
Mon, 15 Dec 2025 13:13:41 +0000 (14:13 +0100)
Ensure gt->freq is released when sysfs_create_files() fails
in xe_gt_freq_init(). Without this, the kobject would leak.
Add kobject_put() before returning the error.

Fixes: fdc81c43f0c1 ("drm/xe: use devm_add_action_or_reset() helper")
Signed-off-by: Shuicheng Lin <shuicheng.lin@intel.com>
Reviewed-by: Alex Zuo <alex.zuo@intel.com>
Reviewed-by: Xin Wang <x.wang@intel.com>
Link: https://patch.msgid.link/20251114205638.2184529-2-shuicheng.lin@intel.com
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
(cherry picked from commit 251be5fb4982ebb0f5a81b62d975bd770f3ad5c2)
Signed-off-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
drivers/gpu/drm/xe/xe_gt_freq.c

index 849ea6c86e8e2a8b3d88cf694b253e5434353422..ce3c7810469f7b18c77d6ca68561c8a5202261fb 100644 (file)
@@ -293,8 +293,10 @@ int xe_gt_freq_init(struct xe_gt *gt)
                return -ENOMEM;
 
        err = sysfs_create_files(gt->freq, freq_attrs);
-       if (err)
+       if (err) {
+               kobject_put(gt->freq);
                return err;
+       }
 
        err = devm_add_action_or_reset(xe->drm.dev, freq_fini, gt->freq);
        if (err)