[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20241021021412.5728-1-zenghongling@kylinos.cn>
Date: Mon, 21 Oct 2024 10:14:12 +0800
From: Hongling Zeng <zenghongling@...inos.cn>
To: linux-kernel@...r.kernel.org,
platform-driver-x86@...r.kernel.org
Cc: stuart.w.hayes@...il.com,
hdegoede@...hat.com,
ilpo.jarvinen@...ux.intel.com,
zhongling0719@....com,
Hongling Zeng <zenghongling@...inos.cn>
Subject: [PATCH] platform/x86: dell-dcdbase: Replace snprintf in show functions with sysfs_emit
show() must not use snprintf() when formatting the value to be
returned to user space
Signed-off-by: Hongling Zeng <zenghongling@...inos.cn>
---
drivers/platform/x86/dell/dcdbas.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/platform/x86/dell/dcdbas.c b/drivers/platform/x86/dell/dcdbas.c
index a60e350..143fd0a 100644
--- a/drivers/platform/x86/dell/dcdbas.c
+++ b/drivers/platform/x86/dell/dcdbas.c
@@ -132,14 +132,14 @@ static ssize_t smi_data_buf_phys_addr_show(struct device *dev,
struct device_attribute *attr,
char *buf)
{
- return sprintf(buf, "%x\n", (u32)smi_buf.dma);
+ return sysfs_emit(buf, "%x\n", (u32)smi_buf.dma);
}
static ssize_t smi_data_buf_size_show(struct device *dev,
struct device_attribute *attr,
char *buf)
{
- return sprintf(buf, "%lu\n", smi_buf.size);
+ return sysfs_emit(buf, "%lu\n", smi_buf.size);
}
static ssize_t smi_data_buf_size_store(struct device *dev,
@@ -200,7 +200,7 @@ static ssize_t host_control_action_show(struct device *dev,
struct device_attribute *attr,
char *buf)
{
- return sprintf(buf, "%u\n", host_control_action);
+ return sysfs_emit(buf, "%u\n", host_control_action);
}
static ssize_t host_control_action_store(struct device *dev,
@@ -224,7 +224,7 @@ static ssize_t host_control_smi_type_show(struct device *dev,
struct device_attribute *attr,
char *buf)
{
- return sprintf(buf, "%u\n", host_control_smi_type);
+ return sysfs_emit(buf, "%u\n", host_control_smi_type);
}
static ssize_t host_control_smi_type_store(struct device *dev,
@@ -239,7 +239,7 @@ static ssize_t host_control_on_shutdown_show(struct device *dev,
struct device_attribute *attr,
char *buf)
{
- return sprintf(buf, "%u\n", host_control_on_shutdown);
+ return sysfs_emit(buf, "%u\n", host_control_on_shutdown);
}
static ssize_t host_control_on_shutdown_store(struct device *dev,
--
2.1.0
Powered by blists - more mailing lists