* [PATCH] staging: line6: use kstrtoint() instead of simple_strtoul()
@ 2012-11-29 20:03 Laurent Navet [Mali]
2012-11-29 20:14 ` [Line6linux-devel] " Stefan Hajnoczi
2012-11-29 21:52 ` Dan Carpenter
0 siblings, 2 replies; 3+ messages in thread
From: Laurent Navet [Mali] @ 2012-11-29 20:03 UTC (permalink / raw)
To: devel; +Cc: line6linux-devel, linux-kernel, gregkh, Laurent Navet [Mali]
From: "Laurent Navet [Mali]" <laurent.navet@gmail.com>
staging: line6: pcm.c
call to obsolete simple_strtoul() function is replaced
by kstrtoint() in pcm_set_impulse_period().
Also check the return code.
Signed-off-by: Laurent Navet [Mali] <laurent.navet@gmail.com>
---
drivers/staging/line6/pcm.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/drivers/staging/line6/pcm.c b/drivers/staging/line6/pcm.c
index a0ce781..876ab89 100644
--- a/drivers/staging/line6/pcm.c
+++ b/drivers/staging/line6/pcm.c
@@ -81,7 +81,13 @@ static ssize_t pcm_set_impulse_period(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t count)
{
- dev2pcm(dev)->impulse_period = simple_strtoul(buf, NULL, 10);
+ int value;
+ int rv;
+ rv = kstrtoint(buf, 10, &value);
+ if (rv < 0)
+ return rv;
+
+ dev2pcm(dev)->impulse_period = value;
return count;
}
--
1.7.10.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Line6linux-devel] [PATCH] staging: line6: use kstrtoint() instead of simple_strtoul()
2012-11-29 20:03 [PATCH] staging: line6: use kstrtoint() instead of simple_strtoul() Laurent Navet [Mali]
@ 2012-11-29 20:14 ` Stefan Hajnoczi
2012-11-29 21:52 ` Dan Carpenter
1 sibling, 0 replies; 3+ messages in thread
From: Stefan Hajnoczi @ 2012-11-29 20:14 UTC (permalink / raw)
To: Laurent Navet [Mali]
Cc: devel, Greg Kroah-Hartman, line6linux-devel@lists.sourceforge.net,
linux-kernel
On Thu, Nov 29, 2012 at 9:03 PM, Laurent Navet [Mali]
<laurent.navet@gmail.com> wrote:
> From: "Laurent Navet [Mali]" <laurent.navet@gmail.com>
>
> staging: line6: pcm.c
> call to obsolete simple_strtoul() function is replaced
> by kstrtoint() in pcm_set_impulse_period().
> Also check the return code.
>
> Signed-off-by: Laurent Navet [Mali] <laurent.navet@gmail.com>
> ---
> drivers/staging/line6/pcm.c | 8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
Reviewed-by: Stefan Hajnoczi <stefanha@gmail.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] staging: line6: use kstrtoint() instead of simple_strtoul()
2012-11-29 20:03 [PATCH] staging: line6: use kstrtoint() instead of simple_strtoul() Laurent Navet [Mali]
2012-11-29 20:14 ` [Line6linux-devel] " Stefan Hajnoczi
@ 2012-11-29 21:52 ` Dan Carpenter
1 sibling, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2012-11-29 21:52 UTC (permalink / raw)
To: Laurent Navet [Mali]; +Cc: devel, gregkh, line6linux-devel, linux-kernel
On Thu, Nov 29, 2012 at 09:03:38PM +0100, Laurent Navet [Mali] wrote:
> From: "Laurent Navet [Mali]" <laurent.navet@gmail.com>
>
> staging: line6: pcm.c
> call to obsolete simple_strtoul() function is replaced
> by kstrtoint() in pcm_set_impulse_period().
> Also check the return code.
>
> Signed-off-by: Laurent Navet [Mali] <laurent.navet@gmail.com>
> ---
> drivers/staging/line6/pcm.c | 8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/staging/line6/pcm.c b/drivers/staging/line6/pcm.c
> index a0ce781..876ab89 100644
> --- a/drivers/staging/line6/pcm.c
> +++ b/drivers/staging/line6/pcm.c
> @@ -81,7 +81,13 @@ static ssize_t pcm_set_impulse_period(struct device *dev,
> struct device_attribute *attr,
> const char *buf, size_t count)
> {
> - dev2pcm(dev)->impulse_period = simple_strtoul(buf, NULL, 10);
> + int value;
> + int rv;
This uses spaces instead of tabs. Run scripts/checkpatch.pl over
the patch before submitting.
Put a blank line here between the declarations and the code.
I see that you copied "rv" from the other places in the file and
generally matching the context is good, but in this case I think
"rv" is non-standard. Normally we would use "ret" or "rc".
> + rv = kstrtoint(buf, 10, &value);
> + if (rv < 0)
> + return rv;
Could you fix up those small details and resend?
regards,
dan carpenter
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-11-29 21:53 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-29 20:03 [PATCH] staging: line6: use kstrtoint() instead of simple_strtoul() Laurent Navet [Mali]
2012-11-29 20:14 ` [Line6linux-devel] " Stefan Hajnoczi
2012-11-29 21:52 ` Dan Carpenter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox