Skip to content

Commit b32045d

Browse files
ShuichengLinThomas Hellström
authored andcommitted
drm/xe: Fix freq kobject leak on sysfs_create_files failure
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: fdc81c4 ("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 251be5f) Signed-off-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
1 parent 8f0b4cc commit b32045d

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

drivers/gpu/drm/xe/xe_gt_freq.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,8 +293,10 @@ int xe_gt_freq_init(struct xe_gt *gt)
293293
return -ENOMEM;
294294

295295
err = sysfs_create_files(gt->freq, freq_attrs);
296-
if (err)
296+
if (err) {
297+
kobject_put(gt->freq);
297298
return err;
299+
}
298300

299301
err = devm_add_action_or_reset(xe->drm.dev, freq_fini, gt->freq);
300302
if (err)

0 commit comments

Comments
 (0)