[PATCH] staging: speakup: replace simple_strtoul with kstrtoul

Daniel Baluta daniel.baluta at gmail.com
Thu Sep 18 23:09:19 EEST 2014


On Thu, Sep 18, 2014 at 2:42 PM, Roxana Blaj <roxanagabriela10 at gmail.com> wrote:
> This fixes the warning:
> WARNING: simple_strtoul is obsolete, use kstrtoul instead
>
> Signed-off-by: Roxana Blaj <roxanagabriela10 at gmail.com>
> ---
>  drivers/staging/speakup/kobjects.c | 17 ++++++++++++++++-
>  1 file changed, 16 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/staging/speakup/kobjects.c b/drivers/staging/speakup/kobjects.c
> index bcc7f62..b26b514 100644
> --- a/drivers/staging/speakup/kobjects.c
> +++ b/drivers/staging/speakup/kobjects.c
> @@ -126,6 +126,7 @@ static ssize_t chars_chartab_store(struct kobject *kobj,
>         int do_characters = !strcmp(attr->attr.name, "characters");
>         size_t desc_length = 0;
>         int i;
> +       int ret;
>
>         spin_lock_irqsave(&speakup_info.spinlock, flags);
>         while (cp < end) {
> @@ -153,7 +154,13 @@ static ssize_t chars_chartab_store(struct kobject *kobj,
>                         continue;
>                 }
>
> -               index = simple_strtoul(cp, &temp, 10);
> +               temp = cp;
> +               ret = kstrtoul(temp, 10, &index);
> +               if (ret) {
> +                       rejected++;
> +                       cp = linefeed + 1;
> +                       continue;
> +               }

This doesn't look good. You change the logic of the program.

Have a look at this link: http://comments.gmane.org/gmane.linux.kernel.mm/119038

thanks,
Daniel.


More information about the firefly mailing list