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

* Re: [PATCH v2 2/2] staging: greybus: Replace sscanf with kstrto* to single variable conversion.
  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
  0 siblings, 1 reply; 3+ messages in thread
From: Greg KH @ 2016-10-14  7:40 UTC (permalink / raw)
  To: Elise Lennion; +Cc: vaibhav.sr, mgreer, johan, elder, outreachy-kernel

On Thu, Oct 13, 2016 at 07:45:59PM -0300, Elise Lennion wrote:
> 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.

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


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

* Re: [PATCH v2 2/2] staging: greybus: Replace sscanf with kstrto* to single variable conversion.
  2016-10-14  7:40 ` Greg KH
@ 2016-10-14 22:06   ` Elise Lennion
  0 siblings, 0 replies; 3+ messages in thread
From: Elise Lennion @ 2016-10-14 22:06 UTC (permalink / raw)
  To: Greg KH; +Cc: vaibhav.sr, mgreer, johan, elder, outreachy-kernel

On Fri, Oct 14, 2016 at 09:40:23AM +0200, Greg KH wrote:
> On Thu, Oct 13, 2016 at 07:45:59PM -0300, Elise Lennion wrote:
> > 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.
> 
> 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


^ permalink raw reply	[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.