Per filesystems/sysfs.rst, show() should only use sysfs_emit() or sysfs_emit_at() when formatting the value to be returned to user space. coccinelle complains that there are still a couple of functions that use snprintf(). Convert them to sysfs_emit(). > ./drivers/scsi/fcoe/fcoe_sysfs.c:253:8-16: WARNING: please use sysfs_emit > ./drivers/scsi/fcoe/fcoe_sysfs.c:268:8-16: WARNING: please use sysfs_emit > ./drivers/scsi/fcoe/fcoe_sysfs.c:376:8-16: WARNING: please use sysfs_emit No functional change intended CC: Hannes Reinecke <hare@xxxxxxx> CC: "James E.J. Bottomley" <jejb@xxxxxxxxxxxxx> CC: "Martin K. Petersen" <martin.petersen@xxxxxxxxxx> CC: linux-scsi@xxxxxxxxxxxxxxx Signed-off-by: Li Zhijian <lizhijian@xxxxxxxxxxx> --- drivers/scsi/fcoe/fcoe_sysfs.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/scsi/fcoe/fcoe_sysfs.c b/drivers/scsi/fcoe/fcoe_sysfs.c index e17957f8085c..9705a579e0d0 100644 --- a/drivers/scsi/fcoe/fcoe_sysfs.c +++ b/drivers/scsi/fcoe/fcoe_sysfs.c @@ -250,7 +250,7 @@ static ssize_t show_fcf_state(struct device *dev, name = get_fcoe_fcf_state_name(fcf->state); if (!name) return -EINVAL; - return snprintf(buf, FCOE_FCF_STATE_MAX_NAMELEN, "%s\n", name); + return sysfs_emit(buf, "%s\n", name); } static FCOE_DEVICE_ATTR(fcf, state, S_IRUGO, show_fcf_state, NULL); @@ -265,8 +265,7 @@ static ssize_t show_ctlr_mode(struct device *dev, name = get_fcoe_ctlr_mode_name(ctlr->mode); if (!name) return -EINVAL; - return snprintf(buf, FCOE_MAX_MODENAME_LEN, - "%s\n", name); + return sysfs_emit(buf, "%s\n", name); } static ssize_t store_ctlr_mode(struct device *dev, @@ -373,8 +372,7 @@ static ssize_t show_ctlr_enabled_state(struct device *dev, name = get_fcoe_ctlr_enabled_state_name(ctlr->enabled); if (!name) return -EINVAL; - return snprintf(buf, FCOE_CTLR_ENABLED_MAX_NAMELEN, - "%s\n", name); + return sysfs_emit(buf, "%s\n", name); } static FCOE_DEVICE_ATTR(ctlr, enabled, S_IRUGO | S_IWUSR, -- 2.29.2