From: Shuah Khan <shuahkhan@gmail.com>
To: Joe Perches <joe@perches.com>
Cc: shuahkhan@gmail.com, tglx@linutronix.de, mingo@redhat.com,
hpa@zytor.com, x86@kernel.org,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] x86: kernel/early_printk.c simple_strtoul cleanup
Date: Tue, 29 May 2012 14:41:31 -0600 [thread overview]
Message-ID: <1338324091.2722.9.camel@lorien2> (raw)
In-Reply-To: <1338151872.28188.16.camel@joe2Laptop>
On Sun, 2012-05-27 at 13:51 -0700, Joe Perches wrote:
> 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...
Will re-work the patch and resend it.
Thanks,
-- Shuah
next prev parent reply other threads:[~2012-05-29 20:41 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-27 16:48 [PATCH] x86: kernel/early_printk.c simple_strtoul cleanup Shuah Khan
2012-05-27 20:51 ` Joe Perches
2012-05-29 20:41 ` Shuah Khan [this message]
2012-05-31 0:40 ` [PATCH RESEND] " Shuah Khan
2012-06-06 15:15 ` [tip:x86/cleanups] x86/early_printk: Replace obsolete simple_strtoul() usage with kstrtoint() tip-bot for Shuah Khan
2012-06-22 14:24 ` Ingo Molnar
2012-06-25 17:17 ` Shuah Khan
2012-06-29 12:50 ` Ingo Molnar
2012-06-22 14:40 ` [tip:x86/cleanups] Revert "x86/early_printk: Replace obsolete simple_strtoul() usage with kstrtoint()" tip-bot for Ingo Molnar
2012-07-22 13:58 ` [tip:x86/platform] " tip-bot for Ingo Molnar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1338324091.2722.9.camel@lorien2 \
--to=shuahkhan@gmail.com \
--cc=hpa@zytor.com \
--cc=joe@perches.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.