Skip to content

Commit 982883b

Browse files
novitollgregkh
authored andcommitted
drivers/usb/host: refactor min/max with min_t/max_t
Ensure type safety by using min_t/max_t instead of casted min/max. 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 28d96b7 commit 982883b

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

drivers/usb/host/ehci-hcd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,7 @@ static int ehci_init(struct usb_hcd *hcd)
547547
* make problems: throughput reduction (!), data errors...
548548
*/
549549
if (park) {
550-
park = min(park, (unsigned) 3);
550+
park = min_t(unsigned int, park, 3);
551551
temp |= CMD_PARK;
552552
temp |= park << 8;
553553
}

drivers/usb/host/oxu210hp-hcd.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -902,7 +902,7 @@ static int oxu_buf_alloc(struct oxu_hcd *oxu, struct ehci_qtd *qtd, int len)
902902

903903
/* Find a suitable available data buffer */
904904
for (i = 0; i < BUFFER_NUM;
905-
i += max(a_blocks, (int)oxu->db_used[i])) {
905+
i += max_t(int, a_blocks, oxu->db_used[i])) {
906906

907907
/* Check all the required blocks are available */
908908
for (j = 0; j < a_blocks; j++)
@@ -3040,7 +3040,7 @@ static int oxu_hcd_init(struct usb_hcd *hcd)
30403040
* make problems: throughput reduction (!), data errors...
30413041
*/
30423042
if (park) {
3043-
park = min(park, (unsigned) 3);
3043+
park = min_t(unsigned int, park, 3);
30443044
temp |= CMD_PARK;
30453045
temp |= park << 8;
30463046
}

drivers/usb/host/r8a66597-hcd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1336,7 +1336,7 @@ static void packet_read(struct r8a66597 *r8a66597, u16 pipenum)
13361336
buf = (void *)urb->transfer_buffer + urb->actual_length;
13371337
urb_len = urb->transfer_buffer_length - urb->actual_length;
13381338
}
1339-
bufsize = min(urb_len, (int) td->maxpacket);
1339+
bufsize = min_t(int, urb_len, td->maxpacket);
13401340
if (rcv_len <= bufsize) {
13411341
size = rcv_len;
13421342
} else {

0 commit comments

Comments
 (0)