[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250828162623.4840-3-thorsten.blum@linux.dev>
Date: Thu, 28 Aug 2025 18:26:24 +0200
From: Thorsten Blum <thorsten.blum@...ux.dev>
To: Alan Stern <stern@...land.harvard.edu>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: Thorsten Blum <thorsten.blum@...ux.dev>,
linux-usb@...r.kernel.org,
usb-storage@...ts.one-eyed-alien.net,
linux-kernel@...r.kernel.org
Subject: [PATCH RESEND] 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@...land.harvard.edu>
Signed-off-by: Thorsten Blum <thorsten.blum@...ux.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
Powered by blists - more mailing lists