linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] x86: kernel/early_printk.c simple_strtoul cleanup
@ 2012-05-27 16:48 Shuah Khan
  2012-05-27 20:51 ` Joe Perches
  0 siblings, 1 reply; 10+ messages in thread
From: Shuah Khan @ 2012-05-27 16:48 UTC (permalink / raw)
  To: tglx, mingo, hpa; +Cc: shuahkhan, x86, LKML

Change early_serial_init() to call kstrtoul() instead of calling obsoleted
simple_strtoul().

Signed-off-by: Shuah Khan <shuahkhan@gmail.com>
---
 arch/x86/kernel/early_printk.c |   21 ++++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)

diff --git a/arch/x86/kernel/early_printk.c b/arch/x86/kernel/early_printk.c
index 9b9f18b..a078f4d 100644
--- 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;
 		} else {
 			static const int __initconst bases[] = { 0x3f8, 0x2f8 };
 
 			if (!strncmp(s, "ttyS", 4))
 				s += 4;
-			port = simple_strtoul(s, &e, 10);
-			if (port > 1 || s == e)
+			ret = kstrtoul(s, 10, &val);
+			if (!ret)
+				port = val;
+			if (port > 1)
 				port = 0;
 			early_serial_base = bases[port];
 		}
@@ -149,8 +154,10 @@ static __init void early_serial_init(char *s)
 	outb(0x3, early_serial_base + MCR);	/* DTR + RTS */
 
 	if (*s) {
-		baud = simple_strtoul(s, &e, 0);
-		if (baud == 0 || s == e)
+		ret = kstrtoul(s, 0, &val);
+		if (!ret)
+			baud = val;
+		if (baud == 0)
 			baud = DEFAULT_BAUD;
 	}
 
-- 
1.7.9.5




^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH] x86: kernel/early_printk.c simple_strtoul cleanup
  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
  0 siblings, 1 reply; 10+ messages in thread
From: Joe Perches @ 2012-05-27 20:51 UTC (permalink / raw)
  To: shuahkhan; +Cc: tglx, mingo, hpa, x86, LKML

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...



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] x86: kernel/early_printk.c simple_strtoul cleanup
  2012-05-27 20:51 ` Joe Perches
@ 2012-05-29 20:41   ` Shuah Khan
  2012-05-31  0:40     ` [PATCH RESEND] " Shuah Khan
  0 siblings, 1 reply; 10+ messages in thread
From: Shuah Khan @ 2012-05-29 20:41 UTC (permalink / raw)
  To: Joe Perches; +Cc: shuahkhan, tglx, mingo, hpa, x86, LKML

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



^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH RESEND] x86: kernel/early_printk.c simple_strtoul cleanup
  2012-05-29 20:41   ` Shuah Khan
@ 2012-05-31  0:40     ` 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
                         ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Shuah Khan @ 2012-05-31  0:40 UTC (permalink / raw)
  To: Joe Perches, tglx, mingo, hpa; +Cc: shuahkhan, x86, LKML

Change early_serial_init() to call kstrtoul() instead of calling obsoleted
simple_strtoul().

Signed-off-by: Shuah Khan <shuahkhan@gmail.com>
---
 arch/x86/kernel/early_printk.c |   12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/arch/x86/kernel/early_printk.c b/arch/x86/kernel/early_printk.c
index 9b9f18b..5e47712 100644
--- a/arch/x86/kernel/early_printk.c
+++ b/arch/x86/kernel/early_printk.c
@@ -119,7 +119,7 @@ static __init void early_serial_init(char *s)
 	unsigned char c;
 	unsigned divisor;
 	unsigned baud = DEFAULT_BAUD;
-	char *e;
+	ssize_t ret;
 
 	if (*s == ',')
 		++s;
@@ -127,14 +127,14 @@ static __init void early_serial_init(char *s)
 	if (*s) {
 		unsigned port;
 		if (!strncmp(s, "0x", 2)) {
-			early_serial_base = simple_strtoul(s, &e, 16);
+			ret = kstrtoint(s, 16, &early_serial_base);
 		} else {
 			static const int __initconst bases[] = { 0x3f8, 0x2f8 };
 
 			if (!strncmp(s, "ttyS", 4))
 				s += 4;
-			port = simple_strtoul(s, &e, 10);
-			if (port > 1 || s == e)
+			ret = kstrtouint(s, 10, &port);
+			if (ret || port > 1)
 				port = 0;
 			early_serial_base = bases[port];
 		}
@@ -149,8 +149,8 @@ static __init void early_serial_init(char *s)
 	outb(0x3, early_serial_base + MCR);	/* DTR + RTS */
 
 	if (*s) {
-		baud = simple_strtoul(s, &e, 0);
-		if (baud == 0 || s == e)
+		ret = kstrtouint(s, 0, &baud);
+		if (ret || baud == 0)
 			baud = DEFAULT_BAUD;
 	}
 
-- 
1.7.9.5




^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [tip:x86/cleanups] x86/early_printk: Replace obsolete simple_strtoul() usage with kstrtoint()
  2012-05-31  0:40     ` [PATCH RESEND] " Shuah Khan
@ 2012-06-06 15:15       ` tip-bot for Shuah Khan
  2012-06-22 14:24         ` 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
  2 siblings, 1 reply; 10+ messages in thread
From: tip-bot for Shuah Khan @ 2012-06-06 15:15 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, joe, shuahkhan, tglx

Commit-ID:  fbd24153c48b8425b09c161a020483cd77da870e
Gitweb:     http://git.kernel.org/tip/fbd24153c48b8425b09c161a020483cd77da870e
Author:     Shuah Khan <shuahkhan@gmail.com>
AuthorDate: Wed, 30 May 2012 18:40:03 -0600
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Wed, 6 Jun 2012 11:44:22 +0200

x86/early_printk: Replace obsolete simple_strtoul() usage with kstrtoint()

Change early_serial_init() to call kstrtoul() instead of calling
obsoleted simple_strtoul().

Signed-off-by: Shuah Khan <shuahkhan@gmail.com>
Cc: Joe Perches <joe@perches.com>
Link: http://lkml.kernel.org/r/1338424803.3569.5.camel@lorien2
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 arch/x86/kernel/early_printk.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/arch/x86/kernel/early_printk.c b/arch/x86/kernel/early_printk.c
index 9b9f18b..5e47712 100644
--- a/arch/x86/kernel/early_printk.c
+++ b/arch/x86/kernel/early_printk.c
@@ -119,7 +119,7 @@ static __init void early_serial_init(char *s)
 	unsigned char c;
 	unsigned divisor;
 	unsigned baud = DEFAULT_BAUD;
-	char *e;
+	ssize_t ret;
 
 	if (*s == ',')
 		++s;
@@ -127,14 +127,14 @@ static __init void early_serial_init(char *s)
 	if (*s) {
 		unsigned port;
 		if (!strncmp(s, "0x", 2)) {
-			early_serial_base = simple_strtoul(s, &e, 16);
+			ret = kstrtoint(s, 16, &early_serial_base);
 		} else {
 			static const int __initconst bases[] = { 0x3f8, 0x2f8 };
 
 			if (!strncmp(s, "ttyS", 4))
 				s += 4;
-			port = simple_strtoul(s, &e, 10);
-			if (port > 1 || s == e)
+			ret = kstrtouint(s, 10, &port);
+			if (ret || port > 1)
 				port = 0;
 			early_serial_base = bases[port];
 		}
@@ -149,8 +149,8 @@ static __init void early_serial_init(char *s)
 	outb(0x3, early_serial_base + MCR);	/* DTR + RTS */
 
 	if (*s) {
-		baud = simple_strtoul(s, &e, 0);
-		if (baud == 0 || s == e)
+		ret = kstrtouint(s, 0, &baud);
+		if (ret || baud == 0)
 			baud = DEFAULT_BAUD;
 	}
 

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [tip:x86/cleanups] x86/early_printk: Replace obsolete simple_strtoul() usage with kstrtoint()
  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
  0 siblings, 1 reply; 10+ messages in thread
From: Ingo Molnar @ 2012-06-22 14:24 UTC (permalink / raw)
  To: hpa, linux-kernel, shuahkhan, joe, tglx; +Cc: linux-tip-commits


* tip-bot for Shuah Khan <shuahkhan@gmail.com> wrote:

> Commit-ID:  fbd24153c48b8425b09c161a020483cd77da870e
> Gitweb:     http://git.kernel.org/tip/fbd24153c48b8425b09c161a020483cd77da870e
> Author:     Shuah Khan <shuahkhan@gmail.com>
> AuthorDate: Wed, 30 May 2012 18:40:03 -0600
> Committer:  Ingo Molnar <mingo@kernel.org>
> CommitDate: Wed, 6 Jun 2012 11:44:22 +0200
> 
> x86/early_printk: Replace obsolete simple_strtoul() usage with kstrtoint()
> 
> Change early_serial_init() to call kstrtoul() instead of calling
> obsoleted simple_strtoul().
> 
> Signed-off-by: Shuah Khan <shuahkhan@gmail.com>
> Cc: Joe Perches <joe@perches.com>
> Link: http://lkml.kernel.org/r/1338424803.3569.5.camel@lorien2
> Signed-off-by: Ingo Molnar <mingo@kernel.org>
> ---
>  arch/x86/kernel/early_printk.c |   12 ++++++------
>  1 files changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/arch/x86/kernel/early_printk.c b/arch/x86/kernel/early_printk.c
> index 9b9f18b..5e47712 100644
> --- a/arch/x86/kernel/early_printk.c
> +++ b/arch/x86/kernel/early_printk.c
> @@ -119,7 +119,7 @@ static __init void early_serial_init(char *s)
>  	unsigned char c;
>  	unsigned divisor;
>  	unsigned baud = DEFAULT_BAUD;
> -	char *e;
> +	ssize_t ret;
>  
>  	if (*s == ',')
>  		++s;
> @@ -127,14 +127,14 @@ static __init void early_serial_init(char *s)
>  	if (*s) {
>  		unsigned port;
>  		if (!strncmp(s, "0x", 2)) {
> -			early_serial_base = simple_strtoul(s, &e, 16);
> +			ret = kstrtoint(s, 16, &early_serial_base);
>  		} else {
>  			static const int __initconst bases[] = { 0x3f8, 0x2f8 };
>  
>  			if (!strncmp(s, "ttyS", 4))
>  				s += 4;
> -			port = simple_strtoul(s, &e, 10);
> -			if (port > 1 || s == e)
> +			ret = kstrtouint(s, 10, &port);
> +			if (ret || port > 1)
>  				port = 0;
>  			early_serial_base = bases[port];
>  		}
> @@ -149,8 +149,8 @@ static __init void early_serial_init(char *s)
>  	outb(0x3, early_serial_base + MCR);	/* DTR + RTS */
>  
>  	if (*s) {
> -		baud = simple_strtoul(s, &e, 0);
> -		if (baud == 0 || s == e)
> +		ret = kstrtouint(s, 0, &baud);
> +		if (ret || baud == 0)
>  			baud = DEFAULT_BAUD;
>  	}

This commit is quite buggy: kstrto*int() can return an error but 
it's not checked in every path above. simple_strtoul() on the 
other hand could not fail, so this patch subtly intruduces new 
failure modes.

I'm dropping this patch.

Thanks,

	Ingo

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [tip:x86/cleanups] Revert "x86/early_printk: Replace obsolete simple_strtoul() usage with kstrtoint()"
  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:40       ` tip-bot for Ingo Molnar
  2012-07-22 13:58       ` [tip:x86/platform] " tip-bot for Ingo Molnar
  2 siblings, 0 replies; 10+ messages in thread
From: tip-bot for Ingo Molnar @ 2012-06-22 14:40 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, shuahkhan, tglx

Commit-ID:  3f44392e7872bdc9470134f29cead2e06ed4d426
Gitweb:     http://git.kernel.org/tip/3f44392e7872bdc9470134f29cead2e06ed4d426
Author:     Ingo Molnar <mingo@kernel.org>
AuthorDate: Fri, 22 Jun 2012 16:25:19 +0200
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Fri, 22 Jun 2012 16:25:19 +0200

Revert "x86/early_printk: Replace obsolete simple_strtoul() usage with kstrtoint()"

This reverts commit fbd24153c48b8425b09c161a020483cd77da870e.

This commit is subtly buggy: kstrto*int() can return an error but
it's not checked in every path. simple_strtoul() on the other hand
could not fail, so this patch subtly intruduces new failure modes.

Signed-off-by: Shuah Khan <shuahkhan@gmail.com>
Link: http://lkml.kernel.org/r/1338424803.3569.5.camel@lorien2
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 arch/x86/kernel/early_printk.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/arch/x86/kernel/early_printk.c b/arch/x86/kernel/early_printk.c
index 5e47712..9b9f18b 100644
--- a/arch/x86/kernel/early_printk.c
+++ b/arch/x86/kernel/early_printk.c
@@ -119,7 +119,7 @@ static __init void early_serial_init(char *s)
 	unsigned char c;
 	unsigned divisor;
 	unsigned baud = DEFAULT_BAUD;
-	ssize_t ret;
+	char *e;
 
 	if (*s == ',')
 		++s;
@@ -127,14 +127,14 @@ static __init void early_serial_init(char *s)
 	if (*s) {
 		unsigned port;
 		if (!strncmp(s, "0x", 2)) {
-			ret = kstrtoint(s, 16, &early_serial_base);
+			early_serial_base = simple_strtoul(s, &e, 16);
 		} else {
 			static const int __initconst bases[] = { 0x3f8, 0x2f8 };
 
 			if (!strncmp(s, "ttyS", 4))
 				s += 4;
-			ret = kstrtouint(s, 10, &port);
-			if (ret || port > 1)
+			port = simple_strtoul(s, &e, 10);
+			if (port > 1 || s == e)
 				port = 0;
 			early_serial_base = bases[port];
 		}
@@ -149,8 +149,8 @@ static __init void early_serial_init(char *s)
 	outb(0x3, early_serial_base + MCR);	/* DTR + RTS */
 
 	if (*s) {
-		ret = kstrtouint(s, 0, &baud);
-		if (ret || baud == 0)
+		baud = simple_strtoul(s, &e, 0);
+		if (baud == 0 || s == e)
 			baud = DEFAULT_BAUD;
 	}
 

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [tip:x86/cleanups] x86/early_printk: Replace obsolete simple_strtoul() usage with kstrtoint()
  2012-06-22 14:24         ` Ingo Molnar
@ 2012-06-25 17:17           ` Shuah Khan
  2012-06-29 12:50             ` Ingo Molnar
  0 siblings, 1 reply; 10+ messages in thread
From: Shuah Khan @ 2012-06-25 17:17 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: shuahkhan, hpa, linux-kernel, joe, tglx, linux-tip-commits


> 
> I'm dropping this patch.

No problem. I missed return value check in one path. Will fix it and
send the fixed patch. I probably will pool this change with other
simple_strtoul() cleanup related changes I am working on.

-- Shuah


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [tip:x86/cleanups] x86/early_printk: Replace obsolete simple_strtoul() usage with kstrtoint()
  2012-06-25 17:17           ` Shuah Khan
@ 2012-06-29 12:50             ` Ingo Molnar
  0 siblings, 0 replies; 10+ messages in thread
From: Ingo Molnar @ 2012-06-29 12:50 UTC (permalink / raw)
  To: Shuah Khan; +Cc: hpa, linux-kernel, joe, tglx, linux-tip-commits


* Shuah Khan <shuahkhan@gmail.com> wrote:

> > I'm dropping this patch.
> 
> No problem. I missed return value check in one path. Will fix 
> it and send the fixed patch. I probably will pool this change 
> with other simple_strtoul() cleanup related changes I am 
> working on.

Yep, that will probably make it easier to review in a batch, 
looking for side effects and such.

Thanks,

	Ingo

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [tip:x86/platform] Revert "x86/early_printk: Replace obsolete simple_strtoul() usage with kstrtoint()"
  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: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-bot for Ingo Molnar
  2 siblings, 0 replies; 10+ messages in thread
From: tip-bot for Ingo Molnar @ 2012-07-22 13:58 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, shuahkhan, tglx

Commit-ID:  36d93d88a5396baa135f8bcde7b8501dfe3b8e53
Gitweb:     http://git.kernel.org/tip/36d93d88a5396baa135f8bcde7b8501dfe3b8e53
Author:     Ingo Molnar <mingo@kernel.org>
AuthorDate: Fri, 22 Jun 2012 16:25:19 +0200
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Sun, 22 Jul 2012 15:47:52 +0200

Revert "x86/early_printk: Replace obsolete simple_strtoul() usage with kstrtoint()"

This reverts commit fbd24153c48b8425b09c161a020483cd77da870e.

This commit is subtly buggy: kstrto*int() can return an error but
it's not checked in every path. simple_strtoul() on the other hand
could not fail, so this patch subtly intruduces new failure modes.

Signed-off-by: Shuah Khan <shuahkhan@gmail.com>
Link: http://lkml.kernel.org/r/1338424803.3569.5.camel@lorien2
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 arch/x86/kernel/early_printk.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/arch/x86/kernel/early_printk.c b/arch/x86/kernel/early_printk.c
index 5e47712..9b9f18b 100644
--- a/arch/x86/kernel/early_printk.c
+++ b/arch/x86/kernel/early_printk.c
@@ -119,7 +119,7 @@ static __init void early_serial_init(char *s)
 	unsigned char c;
 	unsigned divisor;
 	unsigned baud = DEFAULT_BAUD;
-	ssize_t ret;
+	char *e;
 
 	if (*s == ',')
 		++s;
@@ -127,14 +127,14 @@ static __init void early_serial_init(char *s)
 	if (*s) {
 		unsigned port;
 		if (!strncmp(s, "0x", 2)) {
-			ret = kstrtoint(s, 16, &early_serial_base);
+			early_serial_base = simple_strtoul(s, &e, 16);
 		} else {
 			static const int __initconst bases[] = { 0x3f8, 0x2f8 };
 
 			if (!strncmp(s, "ttyS", 4))
 				s += 4;
-			ret = kstrtouint(s, 10, &port);
-			if (ret || port > 1)
+			port = simple_strtoul(s, &e, 10);
+			if (port > 1 || s == e)
 				port = 0;
 			early_serial_base = bases[port];
 		}
@@ -149,8 +149,8 @@ static __init void early_serial_init(char *s)
 	outb(0x3, early_serial_base + MCR);	/* DTR + RTS */
 
 	if (*s) {
-		ret = kstrtouint(s, 0, &baud);
-		if (ret || baud == 0)
+		baud = simple_strtoul(s, &e, 0);
+		if (baud == 0 || s == e)
 			baud = DEFAULT_BAUD;
 	}
 

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2012-07-22 13:59 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).