Re: [PATCH 1/3] memtest: use kstrtouint instead of simple_strtoul

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Jun 19, 2015 at 5:58 PM, Vladimir Murzin
<vladimir.murzin@xxxxxxx> wrote:
> Since simple_strtoul is obsolete and memtest_pattern is type of int, use
> kstrtouint instead.
>
> Signed-off-by: Vladimir Murzin <vladimir.murzin@xxxxxxx>
> ---
>  mm/memtest.c |   14 +++++++++-----
>  1 file changed, 9 insertions(+), 5 deletions(-)
>
> diff --git a/mm/memtest.c b/mm/memtest.c
> index 1997d93..895a43c 100644
> --- a/mm/memtest.c
> +++ b/mm/memtest.c
> @@ -88,14 +88,18 @@ static void __init do_one_pass(u64 pattern, phys_addr_t start, phys_addr_t end)
>  }
>
>  /* default is disabled */
> -static int memtest_pattern __initdata;
> +static unsigned int memtest_pattern __initdata;
>
>  static int __init parse_memtest(char *arg)
>  {
> -       if (arg)
> -               memtest_pattern = simple_strtoul(arg, NULL, 0);
> -       else
> -               memtest_pattern = ARRAY_SIZE(patterns);
> +       if (arg) {
> +               int err = kstrtouint(arg, 0, &memtest_pattern);
> +
> +               if (!err)
> +                       return 0;
kstrtouint returns 0 for success, in case of error you will fallback
and execute following line. It is definetely change of behaviour.
> +       }
> +
> +       memtest_pattern = ARRAY_SIZE(patterns);
>
>         return 0;
>  }
> --
> 1.7.9.5
>
> --
> To unsubscribe, send a message with 'unsubscribe linux-mm' in
> the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
> see: http://www.linux-mm.org/ .
> Don't email: <a hrefmailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>



-- 
Leon Romanovsky | Independent Linux Consultant
        www.leon.nu | leon@xxxxxxx

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]