From: Thorsten Blum <thorsten.blum@linux.dev>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Dave Penkler <dpenkler@gmail.com>,
Oliver Neukum <oneukum@suse.com>
Cc: Thorsten Blum <thorsten.blum@linux.dev>,
linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] usb: usbtmc: Remove unnecessary local variable from usbtmc_ioctl_request
Date: Thu, 18 Sep 2025 17:13:22 +0200 [thread overview]
Message-ID: <20250918151328.331015-1-thorsten.blum@linux.dev> (raw)
The local variable 'res' is only used to temporary store the results of
calling copy_from_user() and copy_to_user(). Use the results directly
and remove the local variable.
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
drivers/usb/class/usbtmc.c | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/drivers/usb/class/usbtmc.c b/drivers/usb/class/usbtmc.c
index 75de29725a45..206f1b738ed3 100644
--- a/drivers/usb/class/usbtmc.c
+++ b/drivers/usb/class/usbtmc.c
@@ -1936,10 +1936,8 @@ static int usbtmc_ioctl_request(struct usbtmc_device_data *data,
u8 *buffer = NULL;
int rv;
unsigned int is_in, pipe;
- unsigned long res;
- res = copy_from_user(&request, arg, sizeof(struct usbtmc_ctrlrequest));
- if (res)
+ if (copy_from_user(&request, arg, sizeof(struct usbtmc_ctrlrequest)))
return -EFAULT;
if (request.req.wLength > USBTMC_BUFSIZE)
@@ -1956,9 +1954,8 @@ static int usbtmc_ioctl_request(struct usbtmc_device_data *data,
if (!is_in) {
/* Send control data to device */
- res = copy_from_user(buffer, request.data,
- request.req.wLength);
- if (res) {
+ if (copy_from_user(buffer, request.data,
+ request.req.wLength)) {
rv = -EFAULT;
goto exit;
}
@@ -1984,8 +1981,7 @@ static int usbtmc_ioctl_request(struct usbtmc_device_data *data,
if (rv && is_in) {
/* Read control data from device */
- res = copy_to_user(request.data, buffer, rv);
- if (res)
+ if (copy_to_user(request.data, buffer, rv))
rv = -EFAULT;
}
--
2.51.0
reply other threads:[~2025-09-18 15:13 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20250918151328.331015-1-thorsten.blum@linux.dev \
--to=thorsten.blum@linux.dev \
--cc=dpenkler@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=oneukum@suse.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.