Skip to contentSkip to conversation

Staging: speakup: Replace simple_strtoul with kstrtoul

PATCH In review Mihaela Muraru 2 participants 4 messages Oct 11, 2016 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Staging: speakup: Replace simple_strtoul with kstrtoul

This patch fixes up a checkpatch.pl warning :
WARNING: simple_strtoul is obsolete, use kstrtoul instead.

---
 drivers/staging/speakup/kobjects.c | 5 ++++-
 drivers/staging/speakup/main.c     | 5 ++++-
 2 files changed, 8 insertions(+), 2 deletions(-)
drivers/staging/speakup/kobjects.c +4 -1
index e744aa9..6466a09 100644
@@ -757,6 +757,7 @@ static ssize_t message_store_helper(const char *buf, size_t count,
 	int used = 0;
 	int rejected = 0;
 	int reset = 0;
+	int ret;
 	enum msg_index_t firstmessage = group->start;
 	enum msg_index_t lastmessage = group->end;
 	enum msg_index_t curmessage;
@@ -786,7 +787,9 @@ static ssize_t message_store_helper(const char *buf, size_t count,
 			continue;
 		}
 
-		index = simple_strtoul(cp, &temp, 10);
+		ret = kstrtoul(cp, 10, &index);
+		if (ret < 0)
+			return ret;
 
 		while ((temp < linefeed) && (*temp == ' ' || *temp == '\t'))
 			temp++;
drivers/staging/speakup/main.c +4 -1
index 97ca4ec..6064fef 100644
@@ -1906,6 +1906,7 @@ static int handle_goto(struct vc_data *vc, u_char type, u_char ch, u_short key)
 {
 	static u_char goto_buf[8];
 	static int num;
+	int ret;
 	int maxlen;
 	char *cp;
 
@@ -1944,7 +1945,9 @@ oops:
 		return 1;
 	}
 
-	goto_pos = simple_strtoul(goto_buf, &cp, 10);
+	ret = kstrtoul(goto_buf, 10, &goto_pos);
+	if (ret < 0)
+		return ret;
 
 	if (*cp == 'x') {
 		if (*goto_buf < '0')
Signature · 1 line
2.7.4
#1 lore raw
Quoted 2 lines · Mihaela Muraru

This patch fixes up a checkpatch.pl warning :
WARNING: simple_strtoul is obsolete, use kstrtoul instead.

Please look at the mailing list archives for why I'm pretty sure this does not work. Have you verified that the code still works the same as before by looking at how the data is handled?

thanks,

greg k-h

#2 lore raw
Quoted 7 lines · Greg Kroah-Hartman
Quoted 2 lines · Mihaela Muraru

This patch fixes up a checkpatch.pl warning :
WARNING: simple_strtoul is obsolete, use kstrtoul instead.

Please look at the mailing list archives for why I'm pretty sure this does not work. Have you verified that the code still works the same as before by looking at how the data is handled?

Thank your for reply.

I am going to check it.

mihaela

Quoted 3 lines

thanks,

greg k-h

#3 lore raw
In reply to Greg Kroah-Hartman
Quoted 7 lines · Greg Kroah-Hartman
Quoted 2 lines · Mihaela Muraru

This patch fixes up a checkpatch.pl warning :
WARNING: simple_strtoul is obsolete, use kstrtoul instead.

Please look at the mailing list archives for why I'm pretty sure this does not work. Have you verified that the code still works the same as before by looking at how the data is handled?

After I read the mail list and after I did some researches indeed I cannot change replace simple_strtoul with kstrtoul.

Thank you for telling me where to search.

mihaela

Quoted 3 lines

thanks,

greg k-h