Thorsten Blum
unread,Aug 28, 2025, 12:27:02 PM (7 days ago) Aug 28Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Alan Stern, Greg Kroah-Hartman, Thorsten Blum, linu...@vger.kernel.org, usb-s...@lists.one-eyed-alien.net, linux-...@vger.kernel.org
Simplify the calculation of 'residue' in rts51x_bulk_transport() and
avoid unnecessarily reassigning 'residue' to itself.
Acked-by: Alan Stern <
st...@rowland.harvard.edu>
Signed-off-by: Thorsten Blum <
thorst...@linux.dev>
---
drivers/usb/storage/realtek_cr.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/usb/storage/realtek_cr.c b/drivers/usb/storage/realtek_cr.c
index 2a6c7c567e1c..758258a569a6 100644
--- a/drivers/usb/storage/realtek_cr.c
+++ b/drivers/usb/storage/realtek_cr.c
@@ -261,8 +261,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;
--
2.50.1