Fwd: [PATCH] scsi: fcoe: convert snprintf to sysfs_emit
From: hanyu001
Date: Fri Jul 14 2023 - 04:03:26 EST
Fix the following coccicheck warning:
drivers/gpu/drm/i915//i915_sysfs.c:266:8-16:
WARNING: use scnprintf or sprintf
drivers/gpu/drm/i915//i915_sysfs.c:285:8-16:
WARNING: use scnprintf or sprintf
drivers/gpu/drm/i915//i915_sysfs.c:276:8-16:
WARNING: use scnprintf or sprintf
drivers/gpu/drm/i915//i915_sysfs.c:335:8-16:
WARNING: use scnprintf or sprintf
drivers/gpu/drm/i915//i915_sysfs.c:390:8-16:
WARNING: use scnprintf or sprintf
drivers/gpu/drm/i915//i915_sysfs.c:465:8-16:
WARNING: use scnprintf or sprintf
drivers/gpu/drm/i915//i915_sysfs.c:107:8-16:
WARNING: use scnprintf or sprintf
drivers/gpu/drm/i915//i915_sysfs.c:75:8-16:
WARNING: use scnprintf or sprintf
drivers/gpu/drm/i915//i915_sysfs.c:83:8-16:
WARNING: use scnprintf or sprintf
drivers/gpu/drm/i915//i915_sysfs.c:91:8-16:
WARNING: use scnprintf or sprintf
drivers/gpu/drm/i915//i915_sysfs.c:99:8-16:
WARNING: use scnprintf or sprintf
drivers/gpu/drm/i915//i915_sysfs.c:326:8-16:
WARNING: use scnprintf or sprintf
./drivers/scsi/fcoe/fcoe_sysfs.c:376:8-16: WARNING: use scnprintf or
sprintf
./drivers/scsi/fcoe/fcoe_sysfs.c:268:8-16: WARNING: use scnprintf or
sprintf
./drivers/scsi/fcoe/fcoe_sysfs.c:253:8-16: WARNING: use scnprintf or
sprintf
Signed-off-by: ztt <1549089851@xxxxxx>
---
drivers/scsi/fcoe/fcoe_sysfs.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/scsi/fcoe/fcoe_sysfs.c
b/drivers/scsi/fcoe/fcoe_sysfs.c
index e17957f8085c..434ef662cfd4 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 scnprintf(buf, FCOE_FCF_STATE_MAX_NAMELEN, "%s\n", name);
}
static FCOE_DEVICE_ATTR(fcf, state, S_IRUGO, show_fcf_state, NULL);
@@ -265,7 +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,
+ return scnprintf(buf, FCOE_MAX_MODENAME_LEN,
"%s\n", name);
}
@@ -373,7 +373,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,
+ return scnprintf(buf, FCOE_CTLR_ENABLED_MAX_NAMELEN,
"%s\n", name);
}