]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/i915: i915_pmu: Use sysfs_emit() instead of sprintf()
authorMadhur Kumar <madhurkumar004@gmail.com>
Tue, 23 Sep 2025 19:50:51 +0000 (01:20 +0530)
committerAndi Shyti <andi.shyti@linux.intel.com>
Thu, 25 Sep 2025 22:38:01 +0000 (00:38 +0200)
Follow the advice in Documentation/filesystems/sysfs.rst:
show() should only use sysfs_emit() or sysfs_emit_at() when formatting
the value to be returned to user space.

Signed-off-by: Madhur Kumar <madhurkumar004@gmail.com>
Reviewed-by: Andi Shyti <andi.shyti@linux.intel.com>
Signed-off-by: Andi Shyti <andi.shyti@linux.intel.com>
Link: https://lore.kernel.org/r/20250923195051.1277855-1-madhurkumar004@gmail.com
drivers/gpu/drm/i915/i915_pmu.c

index 5bc696bfbb0fea82edf4838e843de6e18eb61754..d8f69bba79a9ae4a9924f0be120d34d8ae6e0dbe 100644 (file)
@@ -895,7 +895,7 @@ static ssize_t i915_pmu_format_show(struct device *dev,
        struct i915_str_attribute *eattr;
 
        eattr = container_of(attr, struct i915_str_attribute, attr);
-       return sprintf(buf, "%s\n", eattr->str);
+       return sysfs_emit(buf, "%s\n", eattr->str);
 }
 
 #define I915_PMU_FORMAT_ATTR(_name, _config) \
@@ -925,7 +925,7 @@ static ssize_t i915_pmu_event_show(struct device *dev,
        struct i915_ext_attribute *eattr;
 
        eattr = container_of(attr, struct i915_ext_attribute, attr);
-       return sprintf(buf, "config=0x%lx\n", eattr->val);
+       return sysfs_emit(buf, "config=0x%lx\n", eattr->val);
 }
 
 #define __event(__counter, __name, __unit) \