Replace simple_strtoul with kstrtou8.
simple_strtoul is marked for obsoletion.
Signed-off-by: Marcin Ciupak <[email protected]>
---
drivers/staging/speakup/varhandlers.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/staging/speakup/varhandlers.c b/drivers/staging/speakup/varhandlers.c
index cc984196020f..c219db745865 100644
--- a/drivers/staging/speakup/varhandlers.c
+++ b/drivers/staging/speakup/varhandlers.c
@@ -323,11 +323,10 @@ char *spk_strlwr(char *s)
char *spk_s2uchar(char *start, char *dest)
{
- int val;
+ int ret;
- val = simple_strtoul(skip_spaces(start), &start, 10);
+ ret = kstrtou8(skip_spaces(start), 10, dest);
if (*start == ',')
start++;
- *dest = (u_char)val;
return start;
}
--
2.11.1
Marcin Ciupak, on jeu. 02 mars 2017 15:28:23 +0100, wrote:
> - int val;
> + int ret;
>
> - val = simple_strtoul(skip_spaces(start), &start, 10);
> + ret = kstrtou8(skip_spaces(start), 10, dest);
This is not the same, you need to have start properly move, since it's
used below:
> if (*start == ',')
> start++;
> - *dest = (u_char)val;
> return start;
Samuel
On Thu, Mar 02, 2017 at 04:17:12PM +0100, Samuel Thibault wrote:
> Marcin Ciupak, on jeu. 02 mars 2017 15:28:23 +0100, wrote:
> > - int val;
> > + int ret;
> >
> > - val = simple_strtoul(skip_spaces(start), &start, 10);
> > + ret = kstrtou8(skip_spaces(start), 10, dest);
>
> This is not the same, you need to have start properly move, since it's
> used below:
>
> > if (*start == ',')
> > start++;
> > - *dest = (u_char)val;
> > return start;
>
> Samuel
You are right, start is not updated by kstrtou8 like it is by
simple_strtoul.
If I understand it correctly simple_strtoul cannot be replaced by
kstrtou8 here.
Please discard this patch.
Marcin