[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <41785047-0F4C-4998-8B49-C8D52AB3E5A7@linux.dev>
Date: Tue, 12 Aug 2025 17:35:04 +0200
From: Thorsten Blum <thorsten.blum@...ux.dev>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: Alan Stern <stern@...land.harvard.edu>,
linux-usb@...r.kernel.org,
usb-storage@...ts.one-eyed-alien.net,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] usb: storage: realtek_cr: Simplify
rts51x_bulk_transport()
Hi Greg,
On 12. Aug 2025, at 17:00, Greg Kroah-Hartman wrote:
> On Tue, Aug 12, 2025 at 04:43:58PM +0200, Thorsten Blum wrote:
>> Change the function parameter 'buf_len' from 'int' to 'unsigned int' and
>> only update the local variable 'residue' if needed.
>
> But why?
The parameter 'buf_len' is never negative, so using 'unsigned int' is
semantically better. Since both 'buf_len' and 'residue' are now unsigned
integers, we can directly compare them without the additional
'if (residue)' check.
Unnecessarily reassigning 'residue' to itself has also been removed.
> Update the rts51x_read_status() function signature accordingly.
>>
>> Signed-off-by: Thorsten Blum <thorsten.blum@...ux.dev>
>> ---
>> drivers/usb/storage/realtek_cr.c | 9 +++++----
>> 1 file changed, 5 insertions(+), 4 deletions(-)
>
> Have you tested this change? What caused this to be needed?
I've only compile-tested it due to lack of hardware.
I came across this because Coccinelle/coccicheck suggested using min()
instead of the ternary operator, but I realized it could be simplified
in a cleaner way.
Thanks,
Thorsten
Powered by blists - more mailing lists