[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20241112155817.3512577-8-snovitoll@gmail.com>
Date: Tue, 12 Nov 2024 20:58:16 +0500
From: Sabyrzhan Tasbolatov <snovitoll@...il.com>
To: gregkh@...uxfoundation.org,
andreyknvl@...il.com,
b-liu@...com,
johan@...nel.org,
oneukum@...e.com,
stern@...land.harvard.edu
Cc: linux-kernel@...r.kernel.org,
linux-usb@...r.kernel.org,
snovitoll@...il.com,
usb-storage@...ts.one-eyed-alien.net
Subject: [PATCH v2 7/8] 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@...il.com>
---
drivers/usb/serial/io_edgeport.c | 2 +-
drivers/usb/serial/sierra.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/usb/serial/io_edgeport.c b/drivers/usb/serial/io_edgeport.c
index 28c71d99e857..1fffda7647f9 100644
--- a/drivers/usb/serial/io_edgeport.c
+++ b/drivers/usb/serial/io_edgeport.c
@@ -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",
diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c
index 64a2e0bb5723..741e68e46139 100644
--- a/drivers/usb/serial/sierra.c
+++ b/drivers/usb/serial/sierra.c
@@ -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 */
--
2.34.1
Powered by blists - more mailing lists