Skip to content

Commit 6d8a67e

Browse files
novitollgregkh
authored andcommitted
drivers/usb/serial: refactor min with min_t
Ensure type safety by using min_t() instead of casted min(). Signed-off-by: Sabyrzhan Tasbolatov <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent a05e885 commit 6d8a67e

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

drivers/usb/serial/io_edgeport.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1129,7 +1129,7 @@ static int edge_write(struct tty_struct *tty, struct usb_serial_port *port,
11291129
spin_lock_irqsave(&edge_port->ep_lock, flags);
11301130

11311131
/* calculate number of bytes to put in fifo */
1132-
copySize = min((unsigned int)count,
1132+
copySize = min_t(unsigned int, count,
11331133
(edge_port->txCredits - fifo->count));
11341134

11351135
dev_dbg(&port->dev, "%s of %d byte(s) Fifo room %d -- will copy %d bytes\n",

drivers/usb/serial/sierra.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ static int sierra_write(struct tty_struct *tty, struct usb_serial_port *port,
421421
unsigned long flags;
422422
unsigned char *buffer;
423423
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);
425425
int retval = 0;
426426

427427
/* verify that we actually have some data to write */

0 commit comments

Comments
 (0)