[PATCH] staging: speakup: replace simple_strtoul with kstrtoul

samuel kihahu skihahu at gmail.com
Wed Dec 17 13:43:54 UTC 2014


On Wed, Dec 17, 2014 at 03:11:19PM +0300, Dan Carpenter wrote:
> On Wed, Dec 17, 2014 at 02:56:02PM +0300, samuel kihahu wrote:
> > Replacing obsolete simple_strtoul with kstrtoul.
> > 
> 
> Nope.  That's wrong.  Learn how the functions are different beyond just
> the name.
Noted, have made corrections to fit the kstrtoul and handle the return
value.
-------------- next part --------------
>From 71d2f7123e697b95371585b4af9a0b35262307ea Mon Sep 17 00:00:00 2001
From: samuel kihahu <skihahu at gmail.com>
Date: Wed, 17 Dec 2014 16:31:05 +0300
Subject: [PATCH] staging: speakup: replace simple_strtoul with kstrtoul

Replacing obsolete simple_strtoul with kstrtoul and checking the
return status.

Signed-off-by: samuel kihahu <skihahu at gmail.com>
---
 drivers/staging/speakup/varhandlers.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/speakup/varhandlers.c b/drivers/staging/speakup/varhandlers.c
index d758284..8ac9ad7 100644
--- a/drivers/staging/speakup/varhandlers.c
+++ b/drivers/staging/speakup/varhandlers.c
@@ -321,9 +321,10 @@ char *spk_strlwr(char *s)
 
 char *spk_s2uchar(char *start, char *dest)
 {
-	int val = 0;
+	unsigned long val;
 
-	val = simple_strtoul(skip_spaces(start), &start, 10);
+	if (kstrtoul(skip_spaces(start), &start, val))
+		return -EINVAL;
 	if (*start == ',')
 		start++;
 	*dest = (u_char)val;
-- 
1.8.3.1



More information about the devel mailing list