]> www.infradead.org Git - users/hch/misc.git/commitdiff
usb: storage: realtek_cr: Simplify residue calculation in rts51x_bulk_transport()
authorThorsten Blum <thorsten.blum@linux.dev>
Thu, 28 Aug 2025 16:26:24 +0000 (18:26 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 6 Sep 2025 13:21:25 +0000 (15:21 +0200)
Simplify the calculation of 'residue' in rts51x_bulk_transport() and
avoid unnecessarily reassigning 'residue' to itself.

Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Link: https://lore.kernel.org/r/20250828162623.4840-3-thorsten.blum@linux.dev
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/storage/realtek_cr.c

index cb5bbb19060e79fd79987d5c2106f4445b239321..3cc243956fd4a8490789ab4ae0ffbc376d43118f 100644 (file)
@@ -260,8 +260,8 @@ static int rts51x_bulk_transport(struct us_data *us, u8 lun,
         * try to compute the actual residue, based on how much data
         * was really transferred and what the device tells us
         */
-       if (residue)
-               residue = residue < buf_len ? residue : buf_len;
+       if (residue > buf_len)
+               residue = buf_len;
 
        if (act_len)
                *act_len = buf_len - residue;