]> www.infradead.org Git - users/willy/linux.git/commitdiff
drivers/usb/serial: refactor min with min_t
authorSabyrzhan Tasbolatov <snovitoll@gmail.com>
Tue, 12 Nov 2024 15:58:16 +0000 (20:58 +0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 13 Nov 2024 14:09:51 +0000 (15:09 +0100)
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>
drivers/usb/serial/io_edgeport.c
drivers/usb/serial/sierra.c

index c7d6b5e3f8982b5bbf9b3bd602c21a4bc3447ccb..f0137cbcf8df15cb87eeb0b78d3a005762839357 100644 (file)
@@ -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",
index 64a2e0bb5723ed203b7f84544e7877ce6ba98124..741e68e4613960334cc81f43b5b7555e0e93bf6d 100644 (file)
@@ -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 */