linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH RESEND] usb: storage: realtek_cr: Simplify residue calculation in rts51x_bulk_transport()
@ 2025-08-28 16:26 Thorsten Blum
  2025-08-29  4:34 ` Greg Kroah-Hartman
  0 siblings, 1 reply; 4+ messages in thread
From: Thorsten Blum @ 2025-08-28 16:26 UTC (permalink / raw)
  To: Alan Stern, Greg Kroah-Hartman
  Cc: Thorsten Blum, linux-usb, usb-storage, linux-kernel

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>
---
 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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH RESEND] usb: storage: realtek_cr: Simplify residue calculation in rts51x_bulk_transport()
  2025-08-28 16:26 [PATCH RESEND] usb: storage: realtek_cr: Simplify residue calculation in rts51x_bulk_transport() Thorsten Blum
@ 2025-08-29  4:34 ` Greg Kroah-Hartman
  2025-08-29  7:10   ` Thorsten Blum
  0 siblings, 1 reply; 4+ messages in thread
From: Greg Kroah-Hartman @ 2025-08-29  4:34 UTC (permalink / raw)
  To: Thorsten Blum; +Cc: Alan Stern, linux-usb, usb-storage, linux-kernel

On Thu, Aug 28, 2025 at 06:26:24PM +0200, Thorsten Blum wrote:
> 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>
> ---
>  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
> 
> 

Why is this a RESEND?  What happened to the first one?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH RESEND] usb: storage: realtek_cr: Simplify residue calculation in rts51x_bulk_transport()
  2025-08-29  4:34 ` Greg Kroah-Hartman
@ 2025-08-29  7:10   ` Thorsten Blum
  2025-08-29  8:32     ` Greg Kroah-Hartman
  0 siblings, 1 reply; 4+ messages in thread
From: Thorsten Blum @ 2025-08-29  7:10 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: Alan Stern, linux-usb, usb-storage, linux-kernel

On 29. Aug 2025, at 06:34, Greg Kroah-Hartman wrote:
> On Thu, Aug 28, 2025 at 06:26:24PM +0200, Thorsten Blum wrote:
>> 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>
>> ---
> Why is this a RESEND?  What happened to the first one?

This was patch 2/3 of a patch series that doesn't apply anymore because
you asked me to submit the bugfix in patch 3/3 separately [1].

Since the series doesn't apply anymore and patch 1/3 didn't get any
support [2], I figured it's best to resend this one as a separate patch.

Thanks,
Thorsten

[1] https://lore.kernel.org/lkml/2025081358-posted-ritzy-bd3f@gregkh/
[2] https://lore.kernel.org/lkml/20250813101249.158270-2-thorsten.blum@linux.dev/


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH RESEND] usb: storage: realtek_cr: Simplify residue calculation in rts51x_bulk_transport()
  2025-08-29  7:10   ` Thorsten Blum
@ 2025-08-29  8:32     ` Greg Kroah-Hartman
  0 siblings, 0 replies; 4+ messages in thread
From: Greg Kroah-Hartman @ 2025-08-29  8:32 UTC (permalink / raw)
  To: Thorsten Blum; +Cc: Alan Stern, linux-usb, usb-storage, linux-kernel

On Fri, Aug 29, 2025 at 09:10:00AM +0200, Thorsten Blum wrote:
> On 29. Aug 2025, at 06:34, Greg Kroah-Hartman wrote:
> > On Thu, Aug 28, 2025 at 06:26:24PM +0200, Thorsten Blum wrote:
> >> 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>
> >> ---
> > Why is this a RESEND?  What happened to the first one?
> 
> This was patch 2/3 of a patch series that doesn't apply anymore because
> you asked me to submit the bugfix in patch 3/3 separately [1].
> 
> Since the series doesn't apply anymore and patch 1/3 didn't get any
> support [2], I figured it's best to resend this one as a separate patch.
> 
> Thanks,
> Thorsten
> 
> [1] https://lore.kernel.org/lkml/2025081358-posted-ritzy-bd3f@gregkh/
> [2] https://lore.kernel.org/lkml/20250813101249.158270-2-thorsten.blum@linux.dev/
> 

Ah, that's better, you should have put that below the --- line to make
it more obvious as I didn't remember that at all :)

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-08-29  8:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-28 16:26 [PATCH RESEND] usb: storage: realtek_cr: Simplify residue calculation in rts51x_bulk_transport() Thorsten Blum
2025-08-29  4:34 ` Greg Kroah-Hartman
2025-08-29  7:10   ` Thorsten Blum
2025-08-29  8:32     ` Greg Kroah-Hartman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).