[prev in list] [next in list] [prev in thread] [next in thread] 

List:       git-commits-head
Subject:    usb: misc: ehset: fix wrong if condition
From:       Linux Kernel Mailing List <linux-kernel () vger ! kernel ! org>
Date:       2023-07-30 19:43:50
Message-ID: git-mailbomb-linux-master-7f2327666a9080e428166964e37548b0168cd5e9 () kernel ! org
[Download RAW message or body]

Commit:     7f2327666a9080e428166964e37548b0168cd5e9
Parent:     b32b8f2b9542d8039f5468303a6ca78c1b5611a5
Refname:    refs/heads/master
Web:        https://git.kernel.org/torvalds/c/7f2327666a9080e428166964e37548b0168cd5e9
Author:     Xu Yang <xu.yang_2@nxp.com>
AuthorDate: Wed Jul 5 17:52:31 2023 +0800
Committer:  Greg Kroah-Hartman <gregkh@linuxfoundation.org>
CommitDate: Thu Jul 27 10:37:30 2023 +0200

    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>
---
 drivers/usb/misc/ehset.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/misc/ehset.c b/drivers/usb/misc/ehset.c
index 986d6589f0535..36b6e9fa7ffb6 100644
--- a/drivers/usb/misc/ehset.c
+++ b/drivers/usb/misc/ehset.c
@@ -77,7 +77,7 @@ static int ehset_probe(struct usb_interface *intf,
 	switch (test_pid) {
 	case TEST_SE0_NAK_PID:
 		ret = ehset_prepare_port_for_testing(hub_udev, portnum);
-		if (!ret)
+		if (ret < 0)
 			break;
 		ret = usb_control_msg_send(hub_udev, 0, USB_REQ_SET_FEATURE,
 					   USB_RT_PORT, USB_PORT_FEAT_TEST,
@@ -86,7 +86,7 @@ static int ehset_probe(struct usb_interface *intf,
 		break;
 	case TEST_J_PID:
 		ret = ehset_prepare_port_for_testing(hub_udev, portnum);
-		if (!ret)
+		if (ret < 0)
 			break;
 		ret = usb_control_msg_send(hub_udev, 0, USB_REQ_SET_FEATURE,
 					   USB_RT_PORT, USB_PORT_FEAT_TEST,
@@ -95,7 +95,7 @@ static int ehset_probe(struct usb_interface *intf,
 		break;
 	case TEST_K_PID:
 		ret = ehset_prepare_port_for_testing(hub_udev, portnum);
-		if (!ret)
+		if (ret < 0)
 			break;
 		ret = usb_control_msg_send(hub_udev, 0, USB_REQ_SET_FEATURE,
 					   USB_RT_PORT, USB_PORT_FEAT_TEST,
@@ -104,7 +104,7 @@ static int ehset_probe(struct usb_interface *intf,
 		break;
 	case TEST_PACKET_PID:
 		ret = ehset_prepare_port_for_testing(hub_udev, portnum);
-		if (!ret)
+		if (ret < 0)
 			break;
 		ret = usb_control_msg_send(hub_udev, 0, USB_REQ_SET_FEATURE,
 					   USB_RT_PORT, USB_PORT_FEAT_TEST,
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic