Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

usb: usbtmc: Remove unnecessary local variable from usbtmc_ioctl_request

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>
Link: https://lore.kernel.org/r/20250918151328.331015-1-thorsten.blum@linux.dev
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Thorsten Blum and committed by
Greg Kroah-Hartman
6e26324d b61cb441

+4 -8
+4 -8
drivers/usb/class/usbtmc.c
··· 1936 1936 u8 *buffer = NULL; 1937 1937 int rv; 1938 1938 unsigned int is_in, pipe; 1939 - unsigned long res; 1940 1939 1941 - res = copy_from_user(&request, arg, sizeof(struct usbtmc_ctrlrequest)); 1942 - if (res) 1940 + if (copy_from_user(&request, arg, sizeof(struct usbtmc_ctrlrequest))) 1943 1941 return -EFAULT; 1944 1942 1945 1943 if (request.req.wLength > USBTMC_BUFSIZE) ··· 1954 1956 1955 1957 if (!is_in) { 1956 1958 /* Send control data to device */ 1957 - res = copy_from_user(buffer, request.data, 1958 - request.req.wLength); 1959 - if (res) { 1959 + if (copy_from_user(buffer, request.data, 1960 + request.req.wLength)) { 1960 1961 rv = -EFAULT; 1961 1962 goto exit; 1962 1963 } ··· 1981 1984 1982 1985 if (rv && is_in) { 1983 1986 /* Read control data from device */ 1984 - res = copy_to_user(request.data, buffer, rv); 1985 - if (res) 1987 + if (copy_to_user(request.data, buffer, rv)) 1986 1988 rv = -EFAULT; 1987 1989 } 1988 1990