From: Thorsten Blum <thorsten.blum@linux.dev>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Alan Stern <stern@rowland.harvard.edu>,
linux-usb@vger.kernel.org, usb-storage@lists.one-eyed-alien.net,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] usb: storage: realtek_cr: Simplify rts51x_bulk_transport()
Date: Tue, 12 Aug 2025 17:35:04 +0200 [thread overview]
Message-ID: <41785047-0F4C-4998-8B49-C8D52AB3E5A7@linux.dev> (raw)
In-Reply-To: <2025081249-guru-uptight-98bf@gregkh>
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@linux.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
next prev parent reply other threads:[~2025-08-12 15:35 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-12 14:43 Thorsten Blum
2025-08-12 15:00 ` Greg Kroah-Hartman
2025-08-12 15:35 ` Thorsten Blum [this message]
2025-08-12 20:06 ` Alan Stern
2025-08-12 21:28 ` Thorsten Blum
2025-08-13 1:38 ` [usb-storage] " Alan Stern
2025-08-13 10:17 ` [usb-storage] " Thorsten Blum
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=41785047-0F4C-4998-8B49-C8D52AB3E5A7@linux.dev \
--to=thorsten.blum@linux.dev \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=stern@rowland.harvard.edu \
--cc=usb-storage@lists.one-eyed-alien.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®