Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drivers/usb/serial: refactor min with min_t

Ensure type safety by using min_t() instead of casted min().

Signed-off-by: Sabyrzhan Tasbolatov <snovitoll@gmail.com>
Link: https://lore.kernel.org/r/20241112155817.3512577-8-snovitoll@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Sabyrzhan Tasbolatov and committed by
Greg Kroah-Hartman
6d8a67e3 a05e885d

+2 -2
+1 -1
drivers/usb/serial/io_edgeport.c
··· 1129 1129 spin_lock_irqsave(&edge_port->ep_lock, flags); 1130 1130 1131 1131 /* calculate number of bytes to put in fifo */ 1132 - copySize = min((unsigned int)count, 1132 + copySize = min_t(unsigned int, count, 1133 1133 (edge_port->txCredits - fifo->count)); 1134 1134 1135 1135 dev_dbg(&port->dev, "%s of %d byte(s) Fifo room %d -- will copy %d bytes\n",
+1 -1
drivers/usb/serial/sierra.c
··· 421 421 unsigned long flags; 422 422 unsigned char *buffer; 423 423 struct urb *urb; 424 - size_t writesize = min((size_t)count, (size_t)MAX_TRANSFER); 424 + size_t writesize = min_t(size_t, count, MAX_TRANSFER); 425 425 int retval = 0; 426 426 427 427 /* verify that we actually have some data to write */