Skip to content

Commit

Permalink
video: fbdev: udlfb: replace snprintf in show functions with sysfs_emit
Browse files Browse the repository at this point in the history
Use sysfs_emit instead of scnprintf, snprintf or sprintf.

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Jing Yao <yao.jing2@zte.com.cn>
Signed-off-by: Helge Deller <deller@gmx.de>
  • Loading branch information
Jing Yao authored and hdeller committed Feb 11, 2022
1 parent c07a039 commit 81a9982
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions drivers/video/fbdev/udlfb.c
Original file line number Diff line number Diff line change
Expand Up @@ -1426,31 +1426,31 @@ static ssize_t metrics_bytes_rendered_show(struct device *fbdev,
struct device_attribute *a, char *buf) {
struct fb_info *fb_info = dev_get_drvdata(fbdev);
struct dlfb_data *dlfb = fb_info->par;
return snprintf(buf, PAGE_SIZE, "%u\n",
return sysfs_emit(buf, "%u\n",
atomic_read(&dlfb->bytes_rendered));
}

static ssize_t metrics_bytes_identical_show(struct device *fbdev,
struct device_attribute *a, char *buf) {
struct fb_info *fb_info = dev_get_drvdata(fbdev);
struct dlfb_data *dlfb = fb_info->par;
return snprintf(buf, PAGE_SIZE, "%u\n",
return sysfs_emit(buf, "%u\n",
atomic_read(&dlfb->bytes_identical));
}

static ssize_t metrics_bytes_sent_show(struct device *fbdev,
struct device_attribute *a, char *buf) {
struct fb_info *fb_info = dev_get_drvdata(fbdev);
struct dlfb_data *dlfb = fb_info->par;
return snprintf(buf, PAGE_SIZE, "%u\n",
return sysfs_emit(buf, "%u\n",
atomic_read(&dlfb->bytes_sent));
}

static ssize_t metrics_cpu_kcycles_used_show(struct device *fbdev,
struct device_attribute *a, char *buf) {
struct fb_info *fb_info = dev_get_drvdata(fbdev);
struct dlfb_data *dlfb = fb_info->par;
return snprintf(buf, PAGE_SIZE, "%u\n",
return sysfs_emit(buf, "%u\n",
atomic_read(&dlfb->cpu_kcycles_used));
}

Expand Down

0 comments on commit 81a9982

Please sign in to comment.