Commit 6d8a67e3 authored by Sabyrzhan Tasbolatov's avatar Sabyrzhan Tasbolatov Committed by Greg Kroah-Hartman
Browse files

drivers/usb/serial: refactor min with min_t



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

Signed-off-by: default avatarSabyrzhan Tasbolatov <snovitoll@gmail.com>
Link: https://lore.kernel.org/r/20241112155817.3512577-8-snovitoll@gmail.com


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent a05e885d
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1129,7 +1129,7 @@ static int edge_write(struct tty_struct *tty, struct usb_serial_port *port,
	spin_lock_irqsave(&edge_port->ep_lock, flags);

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

	dev_dbg(&port->dev, "%s of %d byte(s) Fifo room  %d -- will copy %d bytes\n",
+1 −1
Original line number Diff line number Diff line
@@ -421,7 +421,7 @@ static int sierra_write(struct tty_struct *tty, struct usb_serial_port *port,
	unsigned long flags;
	unsigned char *buffer;
	struct urb *urb;
	size_t writesize = min((size_t)count, (size_t)MAX_TRANSFER);
	size_t writesize = min_t(size_t, count, MAX_TRANSFER);
	int retval = 0;

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