linux/drivers/usb/class
Dave Penkler 6d929bef6b usb: usbtmc: Fix read_stb function and get_stb ioctl
commit acb3dac280 upstream.

The usbtmc488_ioctl_read_stb function relied on a positive return from
usbtmc_get_stb to reset the srq condition in the driver. The
USBTMC_IOCTL_GET_STB case tested for a positive return to return the stb
to the user.

Commit: <cac01bd178> ("usb: usbtmc: Fix erroneous get_stb ioctl
error returns") changed the return value of usbtmc_get_stb to 0 on
success instead of returning the value of usb_control_msg which is
positive in the normal case. This change caused the function
usbtmc488_ioctl_read_stb and the USBTMC_IOCTL_GET_STB ioctl to no
longer function correctly.

Change the test in usbtmc488_ioctl_read_stb to test for failure
first and return the failure code immediately.
Change the test for the USBTMC_IOCTL_GET_STB ioctl to test for 0
instead of a positive value.

Fixes: cac01bd178 ("usb: usbtmc: Fix erroneous get_stb ioctl error returns")
Cc: stable@vger.kernel.org
Signed-off-by: Dave Penkler <dpenkler@gmail.com>
Link: https://lore.kernel.org/r/20250521121656.18174-3-dpenkler@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
History 2025-06-27 11:05:21 +01:00
..
cdc-acm.c usb: cdc-acm: Fix handling of oversized fragments 2025-03-13 12:50:39 +01:00
cdc-acm.h USB: cdc-acm: fix minor-number release 2021-09-14 10:33:40 +02:00
cdc-wdm.c USB: wdm: add annotation 2025-05-02 07:44:33 +02:00
Kconfig treewide: replace '---help---' in Kconfig files with 'help' 2020-06-14 01:57:21 +09:00
Makefile USB: add SPDX identifiers to all remaining Makefiles 2017-11-07 15:53:48 +01:00
usblp.c USB: usblp: return error when setting unsupported protocol 2025-01-23 17:15:53 +01:00
usbtmc.c usb: usbtmc: Fix read_stb function and get_stb ioctl 2025-06-27 11:05:21 +01:00