vt: convert sysfs sprintf/snprintf family to sysfs_emit
PATCH 1/1 vt: convert sysfs sprintf/snprintf family to sysfs_emit
Fix the following coccicheck warning:
./drivers/tty/vt/vt.c:3909:8-16: WARNING: use scnprintf or sprintf. ./drivers/tty/vt/vt.c:3917:8-16: WARNING: use scnprintf or sprintf
Reported-by Abaci Robot<[email protected]>
Signed-off-by Jiapeng Chong <[email protected]>
--- drivers/tty/vt/vt.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/tty/vt/vt.c +3 -4
@@ -3906,7 +3906,7 @@ static ssize_t show_bind(struct device *dev, struct device_attribute *attr, bind =con_is_bound (con->con);console_unlock (); -return snprintf (buf,PAGE_SIZE ,"%i\n" , bind); +return sysfs_emit (buf,"%i\n" , bind); } static ssize_t show_name(struct device *dev, struct device_attribute *attr,
@@ -3914,9 +3914,8 @@ static ssize_t show_name(struct device *dev, struct device_attribute *attr, {struct con_driver *con =dev_get_drvdata (dev); -return snprintf (buf,PAGE_SIZE ,"%s %s\n" , - (con->flag &CON_DRIVER_FLAG_MODULE ) ?"(M)" :"(S)" , - con->desc); +return sysfs_emit (buf,"%s %s\n" , (con->flag &CON_DRIVER_FLAG_MODULE ) ?"(M)" :"(S)" , + con->desc); }
Signature · 1 line
1.8.3.1
Greg KH
maintainerQuoted 4 lines · Jiapeng Chong
Fix the following coccicheck warning:
./drivers/tty/vt/vt.c:3909:8-16: WARNING: use scnprintf or sprintf. ./drivers/tty/vt/vt.c:3917:8-16: WARNING: use scnprintf or sprintf
Why?
You say what you did, but there is no justification for why this is required in the tree.
Quoted 2 lines
Reported-by Abaci Robot<[email protected]>
You forgot a ' '.
Quoted 19 lines
Signed-off-by Jiapeng Chong <[email protected]>--- drivers/tty/vt/vt.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)drivers/tty/vt/vt.c +1
-1@@ -3906,7 +3906,7 @@ static ssize_t show_bind(struct device *dev, struct device_attribute *attr, bind =con_is_bound (con->con);console_unlock (); -return snprintf (buf,PAGE_SIZE ,"%i\n" , bind); +return sysfs_emit (buf,"%i\n" , bind); } static ssize_t show_name(struct device *dev, struct device_attribute *attr,
drivers/tty/vt/vt.c static ssize_t show_name(struct device *dev, struct device_attribute *attr, · line 3918
Quoted 8 lines
drivers/tty/vt/vt.c +2
-3@@ -3914,9 +3914,8 @@ static ssize_t show_name(struct device *dev, struct device_attribute *attr, {struct con_driver *con =dev_get_drvdata (dev); -return snprintf (buf,PAGE_SIZE ,"%s %s\n" , - (con->flag &CON_DRIVER_FLAG_MODULE ) ?"(M)" :"(S)" , - con->desc); +return sysfs_emit (buf,"%s %s\n" , (con->flag &CON_DRIVER_FLAG_MODULE ) ?"(M)" :"(S)" , + con->desc);
Why make the line longer now? Can't this be a 1 line change here?
And why is this needed?
thanks,
greg k-h