Skip to content

Commit 7f23276

Browse files
Xu Yanggregkh
authored andcommitted
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: f2b4237 ("usb: misc: ehset: Rework test mode entry") Cc: stable <[email protected]> Signed-off-by: Xu Yang <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent b32b8f2 commit 7f23276

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

drivers/usb/misc/ehset.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ static int ehset_probe(struct usb_interface *intf,
7777
switch (test_pid) {
7878
case TEST_SE0_NAK_PID:
7979
ret = ehset_prepare_port_for_testing(hub_udev, portnum);
80-
if (!ret)
80+
if (ret < 0)
8181
break;
8282
ret = usb_control_msg_send(hub_udev, 0, USB_REQ_SET_FEATURE,
8383
USB_RT_PORT, USB_PORT_FEAT_TEST,
@@ -86,7 +86,7 @@ static int ehset_probe(struct usb_interface *intf,
8686
break;
8787
case TEST_J_PID:
8888
ret = ehset_prepare_port_for_testing(hub_udev, portnum);
89-
if (!ret)
89+
if (ret < 0)
9090
break;
9191
ret = usb_control_msg_send(hub_udev, 0, USB_REQ_SET_FEATURE,
9292
USB_RT_PORT, USB_PORT_FEAT_TEST,
@@ -95,7 +95,7 @@ static int ehset_probe(struct usb_interface *intf,
9595
break;
9696
case TEST_K_PID:
9797
ret = ehset_prepare_port_for_testing(hub_udev, portnum);
98-
if (!ret)
98+
if (ret < 0)
9999
break;
100100
ret = usb_control_msg_send(hub_udev, 0, USB_REQ_SET_FEATURE,
101101
USB_RT_PORT, USB_PORT_FEAT_TEST,
@@ -104,7 +104,7 @@ static int ehset_probe(struct usb_interface *intf,
104104
break;
105105
case TEST_PACKET_PID:
106106
ret = ehset_prepare_port_for_testing(hub_udev, portnum);
107-
if (!ret)
107+
if (ret < 0)
108108
break;
109109
ret = usb_control_msg_send(hub_udev, 0, USB_REQ_SET_FEATURE,
110110
USB_RT_PORT, USB_PORT_FEAT_TEST,

0 commit comments

Comments
 (0)