Skip to contentSkip to conversation

USB: serial: ftdi_sio: fix format specifier

PATCH In review Daniels Umanovskis 2 participants 2 messages Apr 26, 2022 – May 5, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 USB: serial: ftdi_sio: fix format specifier

The latency is an unsigned int and should be printed as such

---
 drivers/usb/serial/ftdi_sio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/serial/ftdi_sio.c +1 -1
index 49c08f07c969..b440d338a895 100644
@@ -1671,7 +1671,7 @@ static ssize_t latency_timer_show(struct device *dev,
 	if (priv->flags & ASYNC_LOW_LATENCY)
 		return sprintf(buf, "1\n");
 	else
-		return sprintf(buf, "%i\n", priv->latency);
+		return sprintf(buf, "%u\n", priv->latency);
 }
 
 /* Write a new value of the latency timer, in units of milliseconds. */
Signature · 1 line
2.30.2
maintainer
#1 lore raw
Quoted 12 lines · Daniels Umanovskis

The latency is an unsigned int and should be printed as such

---
 drivers/usb/serial/ftdi_sio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/serial/ftdi_sio.c +0 -0
index 49c08f07c969..b440d338a895 100644

drivers/usb/serial/ftdi_sio.c static ssize_t latency_timer_show(struct device *dev, · line 1677

Quoted 8 lines
drivers/usb/serial/ftdi_sio.c +1 -1
@@ -1671,7 +1671,7 @@ static ssize_t latency_timer_show(struct device *dev,
 	if (priv->flags & ASYNC_LOW_LATENCY)
 		return sprintf(buf, "1\n");
 	else
-		return sprintf(buf, "%i\n", priv->latency);
+		return sprintf(buf, "%u\n", priv->latency);
 }
 
 /* Write a new value of the latency timer, in units of milliseconds. */

While latency is indeed an unsigned int it only holds values in the range 0..255.

Applied with an amended commit:

https://git.kernel.org/pub/scm/linux/kernel/git/johan/usb-serial.git/commit/?h=usb-next

Johan