nvme: convert sysfs sprintf/snprintf family to sysfs_emit
PATCH 1/1 nvme: convert sysfs sprintf/snprintf family to sysfs_emit
Fix the following coccicheck warning:
./drivers/nvme/host/core.c:3580:8-16: WARNING: use scnprintf or sprintf. ./drivers/nvme/host/core.c:3570:8-16: WARNING: use scnprintf or sprintf. ./drivers/nvme/host/core.c:3560:8-16: WARNING: use scnprintf or sprintf. ./drivers/nvme/host/core.c:3526:8-16: WARNING: use scnprintf or sprintf. ./drivers/nvme/host/core.c:2833:8-16: WARNING: use scnprintf or sprintf.
--- drivers/nvme/host/core.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/nvme/host/core.c +5 -5
@@ -2830,7 +2830,7 @@ static ssize_t nvme_subsys_show_nqn(struct device *dev,struct nvme_subsystem *subsys = container_of(dev, struct nvme_subsystem, dev); -return snprintf (buf,PAGE_SIZE ,"%s\n" , subsys->subnqn); +return sysfs_emit (buf,"%s\n" , subsys->subnqn); } static SUBSYS_ATTR_RO(subsysnqn, S_IRUGO, nvme_subsys_show_nqn);
@@ -3523,7 +3523,7 @@ static ssize_t nvme_sysfs_show_transport(struct device *dev, {struct nvme_ctrl *ctrl =dev_get_drvdata (dev); -return snprintf (buf,PAGE_SIZE ,"%s\n" , ctrl->ops->name); +return sysfs_emit (buf,"%s\n" , ctrl->ops->name); } static DEVICE_ATTR(transport, S_IRUGO, nvme_sysfs_show_transport, NULL);
@@ -3557,7 +3557,7 @@ static ssize_t nvme_sysfs_show_subsysnqn(struct device *dev, {struct nvme_ctrl *ctrl =dev_get_drvdata (dev); -return snprintf (buf,PAGE_SIZE ,"%s\n" , ctrl->subsys->subnqn); +return sysfs_emit (buf,"%s\n" , ctrl->subsys->subnqn); } static DEVICE_ATTR(subsysnqn, S_IRUGO, nvme_sysfs_show_subsysnqn, NULL);
@@ -3567,7 +3567,7 @@ static ssize_t nvme_sysfs_show_hostnqn(struct device *dev, {struct nvme_ctrl *ctrl =dev_get_drvdata (dev); -return snprintf (buf,PAGE_SIZE ,"%s\n" , ctrl->opts->host->nqn); +return sysfs_emit (buf,"%s\n" , ctrl->opts->host->nqn); } static DEVICE_ATTR(hostnqn, S_IRUGO, nvme_sysfs_show_hostnqn, NULL);
@@ -3577,7 +3577,7 @@ static ssize_t nvme_sysfs_show_hostid(struct device *dev, {struct nvme_ctrl *ctrl =dev_get_drvdata (dev); -return snprintf (buf,PAGE_SIZE ,"%pU\n" , &ctrl->opts->host->id); +return sysfs_emit (buf,"%pU\n" , &ctrl->opts->host->id); } static DEVICE_ATTR(hostid, S_IRUGO, nvme_sysfs_show_hostid, NULL);
Signature · 7 lines
1.8.3.1 _______________________________________________ Linux-nvme mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-nvme
Quoted 10 lines · Jiapeng Chong
Fix the following coccicheck warning:
./drivers/nvme/host/core.c:3580:8-16: WARNING: use scnprintf or sprintf. ./drivers/nvme/host/core.c:3570:8-16: WARNING: use scnprintf or sprintf. ./drivers/nvme/host/core.c:3560:8-16: WARNING: use scnprintf or sprintf. ./drivers/nvme/host/core.c:3526:8-16: WARNING: use scnprintf or sprintf. ./drivers/nvme/host/core.c:2833:8-16: WARNING: use scnprintf or sprintf.
Reported-by Abaci Robot<[email protected]>Signed-off-by Jiapeng Chong <[email protected]>
Looks good.
_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme
_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme
Thanks,
applied to nvme-5.12.
_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme