[PATCH] usb: storage: make ndecimals unsigned in parse_delay_str()

David Cusimano posted 1 patch 1 week, 2 days ago
drivers/usb/storage/usb.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] usb: storage: make ndecimals unsigned in parse_delay_str()
Posted by David Cusimano 1 week, 2 days ago
From 73039aaf92449baf12dd4f774164cab4b9987a5c Mon Sep 17 00:00:00 2001
From: David Cusimano <david@cusimano.com>
Date: Thu, 16 Jul 2026 14:04:29 -0400
Subject: [PATCH] usb: storage: make ndecimals unsigned in parse_delay_str()

The ndecimals parameter controls how many decimal places are added when the
expected suffix is missing. It is never used as a signed quantity, so make
it
unsigned to better reflect its intended semantics.

Signed-off-by: David Cusimano <david@cusimano.com>
---
 drivers/usb/storage/usb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c
index 064c7fc8e..c5bfedce7 100644
--- a/drivers/usb/storage/usb.c
+++ b/drivers/usb/storage/usb.c
@@ -83,7 +83,7 @@ static unsigned int delay_use = 1 * MSEC_PER_SEC;
  *
  * Returns 0 on success, a negative error code otherwise.
  */
-static int parse_delay_str(const char *str, int ndecimals, const char
*suffix,
+static int parse_delay_str(const char *str, unsigned int ndecimals, const
char *suffix,
            unsigned int *val)
 {
    int n, n2, l;
-- 
2.50.1 (Apple Git-155)
Re: [PATCH] usb: storage: make ndecimals unsigned in parse_delay_str()
Posted by Greg KH 1 week, 2 days ago
On Thu, Jul 16, 2026 at 03:04:00PM -0400, David Cusimano wrote:
> >From 73039aaf92449baf12dd4f774164cab4b9987a5c Mon Sep 17 00:00:00 2001
> From: David Cusimano <david@cusimano.com>
> Date: Thu, 16 Jul 2026 14:04:29 -0400
> Subject: [PATCH] usb: storage: make ndecimals unsigned in parse_delay_str()

Something went really wrong with your email system, this shouldn't be
here, and your patch is corrupted :(

> 
> The ndecimals parameter controls how many decimal places are added when the
> expected suffix is missing. It is never used as a signed quantity, so make
> it
> unsigned to better reflect its intended semantics.

While nice, is this needed?  Are you going to do this for all usages in
this file of the same thing?

We use "int" a lot in the kernel, so be aware that this is going to be
an interesting task, if not kind of pointless?

thanks,

greg k-h