diff options
author | Ye Guojin <ye.guojin@zte.com.cn> | 2021-10-21 14:06:08 +0300 |
---|---|---|
committer | Corey Minyard <cminyard@mvista.com> | 2021-10-21 14:54:12 +0300 |
commit | fc4e78481afa33585195e896f0f9d9cec1129c80 (patch) | |
tree | 3cae2587f8b69e9966896821daedf9cd0065523c /drivers/char/ipmi/ipmi_si_intf.c | |
parent | ed83855f1efceda932a121b9fb13d08b27427f9b (diff) | |
download | linux-fc4e78481afa33585195e896f0f9d9cec1129c80.tar.xz |
char: ipmi: replace snprintf in show functions with sysfs_emit
coccicheck complains about the use of snprintf() in sysfs show
functions:
WARNING use scnprintf or sprintf
Use sysfs_emit instead of scnprintf, snprintf or sprintf makes more
sense.
Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Ye Guojin <ye.guojin@zte.com.cn>
Message-Id: <20211021110608.1060260-1-ye.guojin@zte.com.cn>
Signed-off-by: Corey Minyard <cminyard@mvista.com>
Diffstat (limited to 'drivers/char/ipmi/ipmi_si_intf.c')
-rw-r--r-- | drivers/char/ipmi/ipmi_si_intf.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c index 6f3272b58ced..64dedb3ef8ec 100644 --- a/drivers/char/ipmi/ipmi_si_intf.c +++ b/drivers/char/ipmi/ipmi_si_intf.c @@ -1603,7 +1603,7 @@ static ssize_t name##_show(struct device *dev, \ { \ struct smi_info *smi_info = dev_get_drvdata(dev); \ \ - return snprintf(buf, 10, "%u\n", smi_get_stat(smi_info, name)); \ + return sysfs_emit(buf, "%u\n", smi_get_stat(smi_info, name)); \ } \ static DEVICE_ATTR_RO(name) @@ -1613,7 +1613,7 @@ static ssize_t type_show(struct device *dev, { struct smi_info *smi_info = dev_get_drvdata(dev); - return snprintf(buf, 10, "%s\n", si_to_str[smi_info->io.si_type]); + return sysfs_emit(buf, "%s\n", si_to_str[smi_info->io.si_type]); } static DEVICE_ATTR_RO(type); @@ -1624,7 +1624,7 @@ static ssize_t interrupts_enabled_show(struct device *dev, struct smi_info *smi_info = dev_get_drvdata(dev); int enabled = smi_info->io.irq && !smi_info->interrupt_disabled; - return snprintf(buf, 10, "%d\n", enabled); + return sysfs_emit(buf, "%d\n", enabled); } static DEVICE_ATTR_RO(interrupts_enabled); @@ -1646,7 +1646,7 @@ static ssize_t params_show(struct device *dev, { struct smi_info *smi_info = dev_get_drvdata(dev); - return snprintf(buf, 200, + return sysfs_emit(buf, "%s,%s,0x%lx,rsp=%d,rsi=%d,rsh=%d,irq=%d,ipmb=%d\n", si_to_str[smi_info->io.si_type], addr_space_to_str[smi_info->io.addr_space], |