All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 2/2] staging: greybus: Replace sscanf with kstrto* to single variable conversion.
@ 2016-10-13 22:45 Elise Lennion
  2016-10-14  7:40 ` Greg KH
  0 siblings, 1 reply; 3+ messages in thread
From: Elise Lennion @ 2016-10-13 22:45 UTC (permalink / raw)
  To: vaibhav.sr, mgreer, johan, elder, gregkh, outreachy-kernel

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.

Signed-off-by: Elise Lennion <elise.lennion@gmail.com>
---

 v2: No change since v1 in this file.

 drivers/staging/greybus/audio_manager_sysfs.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/greybus/audio_manager_sysfs.c b/drivers/staging/greybus/audio_manager_sysfs.c
index 376e17c..e74fdcf 100644
--- a/drivers/staging/greybus/audio_manager_sysfs.c
+++ b/drivers/staging/greybus/audio_manager_sysfs.c
@@ -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);
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-10-14 22:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-13 22:45 [PATCH v2 2/2] staging: greybus: Replace sscanf with kstrto* to single variable conversion Elise Lennion
2016-10-14  7:40 ` Greg KH
2016-10-14 22:06   ` Elise Lennion

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.