Skip to contentSkip to conversation

staging: greybus: Replace sscanf with kstrto* to single variable conversion.

PATCH In review Elise Lennion 2 participants 3 messages Oct 13, 2016 – Oct 14, 2016

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v2 2/2 staging: greybus: Replace sscanf with kstrto* to single variable conversion.

Fix checkpatch warning:

WARNING: Prefer kstrto<type> to single variable sscanf

kstrto* is designed to convert string to numerical value and makes it easier to understand what the code does.

---

v2: No change since v1 in this file.

 drivers/staging/greybus/audio_manager_sysfs.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/greybus/audio_manager_sysfs.c +2 -2
index 376e17c..e74fdcf 100644
@@ -44,7 +44,7 @@ static ssize_t manager_sysfs_remove_store(
 {
 	int id;
 
-	int num = sscanf(buf, "%d", &id);
+	int num = kstrtoint(buf, 10, &id);
 
 	if (num != 1)
 		return -EINVAL;
@@ -65,7 +65,7 @@ static ssize_t manager_sysfs_dump_store(
 {
 	int id;
 
-	int num = sscanf(buf, "%d", &id);
+	int num = kstrtoint(buf, 10, &id);
 
 	if (num == 1) {
 		num = gb_audio_manager_dump_module(id);
Signature · 1 line
2.7.4
maintainer
#1 lore raw
Quoted 11 lines · Elise Lennion

Fix checkpatch warning:

WARNING: Prefer kstrto<type> to single variable sscanf

kstrto* is designed to convert string to numerical value and makes it easier to understand what the code does.

---

v2: No change since v1 in this file.

You forgot to add the driver name to the subject :(

#2 lore raw
Quoted 8 lines · Greg KH
Quoted 7 lines · Elise Lennion

Fix checkpatch warning:

WARNING: Prefer kstrto<type> to single variable sscanf

kstrto* is designed to convert string to numerical value and makes it easier to understand what the code does.

Quoted 6 lines
Quoted 4 lines

---

v2: No change since v1 in this file.

You forgot to add the driver name to the subject :(

Oh, sorry. Corrected it in a new version.

New version:
https://groups.google.com/forum/#!topic/outreachy-kernel/rO_sFmskRu4

When the subject of the new version does not match the previous subject, should I manually link the new version to the thread?

thank you,

elise