summaryrefslogtreecommitdiff
path: root/drivers/usb/storage
diff options
context:
space:
mode:
authorThorsten Blum <thorsten.blum@linux.dev>2025-08-28 18:26:24 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-09-06 15:21:25 +0200
commit5195edb359855d9a6460f19b7c3915a8611fceed (patch)
treeb1ffcadfe744b00edc52a8611fec93b73064e725 /drivers/usb/storage
parent811ee632b1f7e543ccaf61d7c241e73c386a6eb2 (diff)
downloadlinux-5195edb359855d9a6460f19b7c3915a8611fceed.tar.gz
linux-5195edb359855d9a6460f19b7c3915a8611fceed.tar.bz2
linux-5195edb359855d9a6460f19b7c3915a8611fceed.zip
usb: storage: realtek_cr: Simplify residue calculation in rts51x_bulk_transport()
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>
Diffstat (limited to 'drivers/usb/storage')
-rw-r--r--drivers/usb/storage/realtek_cr.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/usb/storage/realtek_cr.c b/drivers/usb/storage/realtek_cr.c
index cb5bbb19060e..3cc243956fd4 100644
--- a/drivers/usb/storage/realtek_cr.c
+++ b/drivers/usb/storage/realtek_cr.c
@@ -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;