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: misc: ehset: fix wrong if condition

A negative number from ret means the host controller had failed to send
usb message and 0 means succeed. Therefore, the if logic is wrong here
and this patch will fix it.

Fixes: f2b42379c576 ("usb: misc: ehset: Rework test mode entry")
Cc: stable <stable@kernel.org>
Signed-off-by: Xu Yang <xu.yang_2@nxp.com>
Link: https://lore.kernel.org/r/20230705095231.457860-1-xu.yang_2@nxp.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Xu Yang and committed by
Greg Kroah-Hartman
7f232766 b32b8f2b

+4 -4
+4 -4
drivers/usb/misc/ehset.c
··· 77 77 switch (test_pid) { 78 78 case TEST_SE0_NAK_PID: 79 79 ret = ehset_prepare_port_for_testing(hub_udev, portnum); 80 - if (!ret) 80 + if (ret < 0) 81 81 break; 82 82 ret = usb_control_msg_send(hub_udev, 0, USB_REQ_SET_FEATURE, 83 83 USB_RT_PORT, USB_PORT_FEAT_TEST, ··· 86 86 break; 87 87 case TEST_J_PID: 88 88 ret = ehset_prepare_port_for_testing(hub_udev, portnum); 89 - if (!ret) 89 + if (ret < 0) 90 90 break; 91 91 ret = usb_control_msg_send(hub_udev, 0, USB_REQ_SET_FEATURE, 92 92 USB_RT_PORT, USB_PORT_FEAT_TEST, ··· 95 95 break; 96 96 case TEST_K_PID: 97 97 ret = ehset_prepare_port_for_testing(hub_udev, portnum); 98 - if (!ret) 98 + if (ret < 0) 99 99 break; 100 100 ret = usb_control_msg_send(hub_udev, 0, USB_REQ_SET_FEATURE, 101 101 USB_RT_PORT, USB_PORT_FEAT_TEST, ··· 104 104 break; 105 105 case TEST_PACKET_PID: 106 106 ret = ehset_prepare_port_for_testing(hub_udev, portnum); 107 - if (!ret) 107 + if (ret < 0) 108 108 break; 109 109 ret = usb_control_msg_send(hub_udev, 0, USB_REQ_SET_FEATURE, 110 110 USB_RT_PORT, USB_PORT_FEAT_TEST,