Linux USB
 help / color / mirror / Atom feed
* [PATCH] USB: serial: console: use isdigit() in usb_console_setup()
@ 2026-11-06  9:03 Thorsten Blum
  2026-11-06  9:05 ` sashiko-bot
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Thorsten Blum @ 2026-11-06  9:03 UTC (permalink / raw)
  To: Johan Hovold, Greg Kroah-Hartman; +Cc: Thorsten Blum, linux-usb, linux-kernel

Use isdigit() to replace the open-coded implementation.

Signed-off-by: Thorsten Blum <blum@kernel.org>
---
 drivers/usb/serial/console.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/serial/console.c b/drivers/usb/serial/console.c
index 29f09190846e..25ea57c8fd3f 100644
--- a/drivers/usb/serial/console.c
+++ b/drivers/usb/serial/console.c
@@ -15,6 +15,7 @@
 #include <linux/slab.h>
 #include <linux/tty.h>
 #include <linux/console.h>
+#include <linux/ctype.h>
 #include <linux/serial.h>
 #include <linux/usb.h>
 #include <linux/usb/serial.h>
@@ -70,7 +71,7 @@ static int usb_console_setup(struct console *co, char *options)
 	if (options) {
 		baud = simple_strtoul(options, NULL, 10);
 		s = options;
-		while (*s >= '0' && *s <= '9')
+		while (isdigit(*s))
 			s++;
 		if (*s)
 			parity = *s++;

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

* Re: [PATCH] USB: serial: console: use isdigit() in usb_console_setup()
  2026-11-06  9:03 [PATCH] USB: serial: console: use isdigit() in usb_console_setup() Thorsten Blum
@ 2026-11-06  9:05 ` sashiko-bot
  2026-11-27  9:55 ` Johan Hovold
  2026-11-27 21:23 ` David Laight
  2 siblings, 0 replies; 4+ messages in thread
From: sashiko-bot @ 2026-11-06  9:05 UTC (permalink / raw)
  To: Thorsten Blum; +Cc: linux-usb

> Use isdigit() to replace the open-coded implementation.
> 
> Signed-off-by: Thorsten Blum <blum@kernel.org>

Sashiko has reviewed this patch and found no issues.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261106090304.2410-2-blum@kernel.org?part=1


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

* Re: [PATCH] USB: serial: console: use isdigit() in usb_console_setup()
  2026-11-06  9:03 [PATCH] USB: serial: console: use isdigit() in usb_console_setup() Thorsten Blum
  2026-11-06  9:05 ` sashiko-bot
@ 2026-11-27  9:55 ` Johan Hovold
  2026-11-27 21:23 ` David Laight
  2 siblings, 0 replies; 4+ messages in thread
From: Johan Hovold @ 2026-11-27  9:55 UTC (permalink / raw)
  To: Thorsten Blum; +Cc: Greg Kroah-Hartman, linux-usb, linux-kernel

On Fri, Nov 06, 2026 at 10:03:05AM +0100, Thorsten Blum wrote:
> Use isdigit() to replace the open-coded implementation.
> 
> Signed-off-by: Thorsten Blum <blum@kernel.org>

Applied, thanks.

Johan

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

* Re: [PATCH] USB: serial: console: use isdigit() in usb_console_setup()
  2026-11-06  9:03 [PATCH] USB: serial: console: use isdigit() in usb_console_setup() Thorsten Blum
  2026-11-06  9:05 ` sashiko-bot
  2026-11-27  9:55 ` Johan Hovold
@ 2026-11-27 21:23 ` David Laight
  2 siblings, 0 replies; 4+ messages in thread
From: David Laight @ 2026-11-27 21:23 UTC (permalink / raw)
  To: Thorsten Blum; +Cc: Johan Hovold, Greg Kroah-Hartman, linux-usb, linux-kernel

On Fri,  6 Nov 2026 10:03:05 +0100
Thorsten Blum <blum@kernel.org> wrote:

> Use isdigit() to replace the open-coded implementation.
> 
> Signed-off-by: Thorsten Blum <blum@kernel.org>
> ---
>  drivers/usb/serial/console.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/serial/console.c b/drivers/usb/serial/console.c
> index 29f09190846e..25ea57c8fd3f 100644
> --- a/drivers/usb/serial/console.c
> +++ b/drivers/usb/serial/console.c
> @@ -15,6 +15,7 @@
>  #include <linux/slab.h>
>  #include <linux/tty.h>
>  #include <linux/console.h>
> +#include <linux/ctype.h>
>  #include <linux/serial.h>
>  #include <linux/usb.h>
>  #include <linux/usb/serial.h>
> @@ -70,7 +71,7 @@ static int usb_console_setup(struct console *co, char *options)
>  	if (options) {
>  		baud = simple_strtoul(options, NULL, 10);
>  		s = options;
> -		while (*s >= '0' && *s <= '9')
> +		while (isdigit(*s))
>  			s++;

What was wrong with:
		baud + simple_strtoul(options, &s, 10);
Seems to do just what was wanted.

David

>  		if (*s)
>  			parity = *s++;
> 


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

end of thread, other threads:[~2026-11-27 21:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-06  9:03 [PATCH] USB: serial: console: use isdigit() in usb_console_setup() Thorsten Blum
2026-11-06  9:05 ` sashiko-bot
2026-11-27  9:55 ` Johan Hovold
2026-11-27 21:23 ` David Laight

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox