Skip to contentSkip to conversation

s390:raw3270: Convert sysfs sprintf/snprintf family to sysfs_emit

PATCH In review CGEL 2 participants 2 messages Aug 21, 2021 – Aug 23, 2021 s390

lore
Share & tools
lore

CGEL

author
#0 lore raw

PATCH 1/1 s390:raw3270: Convert sysfs sprintf/snprintf family to sysfs_emit

From: jing yangyang <[email protected]>

Fix the following coccicheck warning:
./drivers/s390/char/raw3270.c:1066:8-16: WARNING: use scnprintf or sprintf ./drivers/s390/char/raw3270.c:1050:8-16: WARNING:use scnprintf or sprintf ./drivers/s390/char/raw3270.c:1058:8-16: WARNING:use scnprintf or sprintf

---
 drivers/s390/char/raw3270.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/s390/char/raw3270.c +3 -3
index 646ec79..be8529f 100644
@@ -1047,7 +1047,7 @@ struct raw3270_view *
 static ssize_t
 raw3270_model_show(struct device *dev, struct device_attribute *attr, char *buf)
 {
-	return snprintf(buf, PAGE_SIZE, "%i\n",
+	return sysfs_emit(buf, "%i\n",
 			((struct raw3270 *) dev_get_drvdata(dev))->model);
 }
 static DEVICE_ATTR(model, 0444, raw3270_model_show, NULL);
@@ -1055,7 +1055,7 @@ struct raw3270_view *
 static ssize_t
 raw3270_rows_show(struct device *dev, struct device_attribute *attr, char *buf)
 {
-	return snprintf(buf, PAGE_SIZE, "%i\n",
+	return sysfs_emit(buf, "%i\n",
 			((struct raw3270 *) dev_get_drvdata(dev))->rows);
 }
 static DEVICE_ATTR(rows, 0444, raw3270_rows_show, NULL);
@@ -1063,7 +1063,7 @@ struct raw3270_view *
 static ssize_t
 raw3270_columns_show(struct device *dev, struct device_attribute *attr, char *buf)
 {
-	return snprintf(buf, PAGE_SIZE, "%i\n",
+	return sysfs_emit(buf, "%i\n",
 			((struct raw3270 *) dev_get_drvdata(dev))->cols);
 }
 static DEVICE_ATTR(columns, 0444, raw3270_columns_show, NULL);
Signature · 1 line
1.8.3.1
maintainer
#1 lore raw
Quoted 9 lines · CGEL

From: jing yangyang <[email protected]>

Fix the following coccicheck warning:
./drivers/s390/char/raw3270.c:1066:8-16: WARNING: use scnprintf or sprintf ./drivers/s390/char/raw3270.c:1050:8-16: WARNING:use scnprintf or sprintf ./drivers/s390/char/raw3270.c:1058:8-16: WARNING:use scnprintf or sprintf

...

drivers/s390/char/raw3270.c struct raw3270_view * · line 1051

Quoted 6 lines

static ssize_t
raw3270_model_show(struct device *dev, struct device_attribute *attr, char *buf) {

drivers/s390/char/raw3270.c +1 -1
-	return snprintf(buf, PAGE_SIZE, "%i\n",
+	return sysfs_emit(buf, "%i\n",
 			((struct raw3270 *) dev_get_drvdata(dev))->model);

Identation of the line following the patched line is now incorrect. Also the sign-off chain is not correct - I also doubt that "CGEL" is a person, but what do I know.

Not applied.