]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
drivers/usb/misc: refactor min with min_t
authorSabyrzhan Tasbolatov <snovitoll@gmail.com>
Tue, 12 Nov 2024 15:58:13 +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 min().

Also add the explicit `unsigned int` as scripts/checkpatch.pl warns about:

WARNING: Prefer 'unsigned int' to bare use of 'unsigned'

Signed-off-by: Sabyrzhan Tasbolatov <snovitoll@gmail.com>
Link: https://lore.kernel.org/r/20241112155817.3512577-5-snovitoll@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/misc/usbtest.c

index caf65f8294db22c74f080d2c2ccd6fe4f994f9bb..8d379ae835bc4524bb48d5796a7a5af1536ce36a 100644 (file)
@@ -2021,7 +2021,8 @@ static struct urb *iso_alloc_urb(
 
        for (i = 0; i < packets; i++) {
                /* here, only the last packet will be short */
-               urb->iso_frame_desc[i].length = min((unsigned) bytes, maxp);
+               urb->iso_frame_desc[i].length = min_t(unsigned int,
+                                                       bytes, maxp);
                bytes -= urb->iso_frame_desc[i].length;
 
                urb->iso_frame_desc[i].offset = maxp * i;