lkml.org 
[lkml]   [2012]   [May]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    SubjectRe: [PATCH] x86: kernel/early_printk.c simple_strtoul cleanup
    From
    Date
    On Sun, 2012-05-27 at 10:48 -0600, Shuah Khan wrote:
    > Change early_serial_init() to call kstrtoul() instead of calling obsoleted
    > simple_strtoul().
    []
    > diff --git a/arch/x86/kernel/early_printk.c b/arch/x86/kernel/early_printk.c
    []
    > @@ -119,22 +119,27 @@ static __init void early_serial_init(char *s)
    > unsigned char c;
    > unsigned divisor;
    > unsigned baud = DEFAULT_BAUD;
    > - char *e;
    > + unsigned long val;
    > + ssize_t ret;
    >
    > if (*s == ',')
    > ++s;
    >
    > if (*s) {
    > - unsigned port;
    > + unsigned port = 0;
    > if (!strncmp(s, "0x", 2)) {
    > - early_serial_base = simple_strtoul(s, &e, 16);
    > + ret = kstrtoul(s, 16, &val);
    > + if (!ret)
    > + early_serial_base = val;

    I believe none of the kstrto<foo> calls set
    the value in the pointer unless successful so
    you don't need a temporary and can simply use:

    ret = kstrtoint(s, 16, &early_serial_base)
    if (ret)

    etc...




    \
     
     \ /
      Last update: 2012-05-27 23:01    [W:0.043 / U:0.744 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site