Commit 7f232766 authored by Xu Yang's avatar Xu Yang Committed by Greg Kroah-Hartman

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: f2b42379 ("usb: misc: ehset: Rework test mode entry")
Cc: stable <stable@kernel.org>
Signed-off-by: default avatarXu Yang <xu.yang_2@nxp.com>
Link: https://lore.kernel.org/r/20230705095231.457860-1-xu.yang_2@nxp.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent b32b8f2b
...@@ -77,7 +77,7 @@ static int ehset_probe(struct usb_interface *intf, ...@@ -77,7 +77,7 @@ static int ehset_probe(struct usb_interface *intf,
switch (test_pid) { switch (test_pid) {
case TEST_SE0_NAK_PID: case TEST_SE0_NAK_PID:
ret = ehset_prepare_port_for_testing(hub_udev, portnum); ret = ehset_prepare_port_for_testing(hub_udev, portnum);
if (!ret) if (ret < 0)
break; break;
ret = usb_control_msg_send(hub_udev, 0, USB_REQ_SET_FEATURE, ret = usb_control_msg_send(hub_udev, 0, USB_REQ_SET_FEATURE,
USB_RT_PORT, USB_PORT_FEAT_TEST, USB_RT_PORT, USB_PORT_FEAT_TEST,
...@@ -86,7 +86,7 @@ static int ehset_probe(struct usb_interface *intf, ...@@ -86,7 +86,7 @@ static int ehset_probe(struct usb_interface *intf,
break; break;
case TEST_J_PID: case TEST_J_PID:
ret = ehset_prepare_port_for_testing(hub_udev, portnum); ret = ehset_prepare_port_for_testing(hub_udev, portnum);
if (!ret) if (ret < 0)
break; break;
ret = usb_control_msg_send(hub_udev, 0, USB_REQ_SET_FEATURE, ret = usb_control_msg_send(hub_udev, 0, USB_REQ_SET_FEATURE,
USB_RT_PORT, USB_PORT_FEAT_TEST, USB_RT_PORT, USB_PORT_FEAT_TEST,
...@@ -95,7 +95,7 @@ static int ehset_probe(struct usb_interface *intf, ...@@ -95,7 +95,7 @@ static int ehset_probe(struct usb_interface *intf,
break; break;
case TEST_K_PID: case TEST_K_PID:
ret = ehset_prepare_port_for_testing(hub_udev, portnum); ret = ehset_prepare_port_for_testing(hub_udev, portnum);
if (!ret) if (ret < 0)
break; break;
ret = usb_control_msg_send(hub_udev, 0, USB_REQ_SET_FEATURE, ret = usb_control_msg_send(hub_udev, 0, USB_REQ_SET_FEATURE,
USB_RT_PORT, USB_PORT_FEAT_TEST, USB_RT_PORT, USB_PORT_FEAT_TEST,
...@@ -104,7 +104,7 @@ static int ehset_probe(struct usb_interface *intf, ...@@ -104,7 +104,7 @@ static int ehset_probe(struct usb_interface *intf,
break; break;
case TEST_PACKET_PID: case TEST_PACKET_PID:
ret = ehset_prepare_port_for_testing(hub_udev, portnum); ret = ehset_prepare_port_for_testing(hub_udev, portnum);
if (!ret) if (ret < 0)
break; break;
ret = usb_control_msg_send(hub_udev, 0, USB_REQ_SET_FEATURE, ret = usb_control_msg_send(hub_udev, 0, USB_REQ_SET_FEATURE,
USB_RT_PORT, USB_PORT_FEAT_TEST, USB_RT_PORT, USB_PORT_FEAT_TEST,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment