From patchwork Wed Jul 5 09:52:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xu Yang X-Patchwork-Id: 13301919 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5872CEB64DA for ; Wed, 5 Jul 2023 09:49:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232500AbjGEJtJ (ORCPT ); Wed, 5 Jul 2023 05:49:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60026 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231789AbjGEJtH (ORCPT ); Wed, 5 Jul 2023 05:49:07 -0400 Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-db3eur04on2080.outbound.protection.outlook.com [40.107.6.80]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6869A1713 for ; Wed, 5 Jul 2023 02:49:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jKxWZyn9XdfqtGdw6rsC1yTjR2bdSa/p5t+F8yqItZyJ/gPJ0/TspSoiXCyF7tg8W81Pqid/JEmA71ddjH/K3CWDRYxOKb9M7DAEUeNN5hWdnjvZMkZyJuaXvrsA+ZIb20cGkubHqY6k5S2nse+WVwVd1xXg16T3C7YjbuIsEeNMabBIw/X9o/2sZCdg9Q3W9gw9OvLtStT/5HiM9BKiRpOzWvoF5ooZ+voqYlNL9/LxsAMOTPSGm+VAPbFUqssH11XKKktH8KDNVlLxSdrRSoYqGroH9v2tIJ0n2WtG9MkEVpAQbD+7XFUfzdTIdg/hIhaFgiSIuwNvbm9Y4Mx6LA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=heACbAkC38dd3EF2M/52ReXGOBvg5eS0yU3ovcgSk98=; b=Z3NJlK+hO7dJKnjwvR8JS1n60Vsk0hUWaK550lCSyHlk3J/uZ82vEe69NuhME0Lx+lAx5uQM5Or+/azcwU25jzXqysWjcChCg0kPhvOmSvv2KsSlOpcfuCjlkOxgpuCb4WzEUeCdHrGmzAoYy9nbthtH8fw1fECloeOOSeQR/FQ8kq2n8/s02R0vPhVPXfGj7JfP6hIOqRYSDJtcQICMkDK0lnoLl1rucJl9PS7DOf+FU3hqnPC55nTOf8yZ8TQE6XMy6F+3vomwVjK2GZVn5L1acfAhJedAuC+bwSdNgnN3OCCRZdvKTVw2MPR9pbWa3fkrBPmODhxLouz5r2m+ZA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=heACbAkC38dd3EF2M/52ReXGOBvg5eS0yU3ovcgSk98=; b=JKIrUXU07gw44/e4rA3SPDG2or4KaLMCdr6Fwc6qWP840eRXSMVo5v7NzNqAzgEB80PGPTS+8PLQMRiYynvAK/XuqsjgvAditMsmn2YGdwPLeW0Jkwd6ZxhEi/7LgNNjmIBScGBk0GS9Rtd36qaMESPkr1IuTI1uj32DuubvlD8= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from DB7PR04MB4505.eurprd04.prod.outlook.com (2603:10a6:5:39::26) by GV1PR04MB9087.eurprd04.prod.outlook.com (2603:10a6:150:22::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6565.17; Wed, 5 Jul 2023 09:49:02 +0000 Received: from DB7PR04MB4505.eurprd04.prod.outlook.com ([fe80::f9b0:8c34:e57:92a4]) by DB7PR04MB4505.eurprd04.prod.outlook.com ([fe80::f9b0:8c34:e57:92a4%7]) with mapi id 15.20.6544.024; Wed, 5 Jul 2023 09:49:02 +0000 From: Xu Yang To: gregkh@linuxfoundation.org Cc: heghedus.razvan@gmail.com, linux-usb@vger.kernel.org, linux-imx@nxp.com, jun.li@nxp.com, xu.yang_2@nxp.com Subject: [PATCH] usb: misc: ehset: fix wrong if condition Date: Wed, 5 Jul 2023 17:52:31 +0800 Message-Id: <20230705095231.457860-1-xu.yang_2@nxp.com> X-Mailer: git-send-email 2.34.1 X-ClientProxiedBy: SI2PR02CA0043.apcprd02.prod.outlook.com (2603:1096:4:196::12) To DB7PR04MB4505.eurprd04.prod.outlook.com (2603:10a6:5:39::26) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB7PR04MB4505:EE_|GV1PR04MB9087:EE_ X-MS-Office365-Filtering-Correlation-Id: d9709024-bb3f-4b2e-905c-08db7d3d102c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: tJkeOUZca61sK6M2mzGA33rJBMsuWovJRrkzx+D4jk7mB5tJi1TMfl8XDvqCPlL9UGfbNCXMW5J01QS+uPPL0VyUNjQHJAXuBtiOmtPouV7gglqK3yYEJjWc6RztIpAmmU2Jvx0PU+T8qXcqfJhECxcDgeXjOKTzXX4HpiqWVCVbQWEFws/crXXDfL2vS0wYjglhQTmglaxCwMYu8PaLIgVhbnWhNAjefq3t53q+oXSVqCEfA2uvI+4Rigzxr7gWYu9j3IG4f32cCFlW7crTtiwgEINzaIzJYRa4JukOKtPMi0okKvHhK7FEobFDFLwdOAVOOX9UomkxHjYEX8xKYg7MhfK5256MZ5RQD2RtduskUjMCycfbz3vQED4CssmHqo9nVS+ieTPSrQXdw96BT+sqjcWifJqqUjVEHnQVDVSXBQx78KzPc21ZNbGA8QoueIgoQJ1YeCxW0n3IBvKG/29zOSX/xMgO4BMNYbzfn2rKIwsTo05W9KrbuH/xxLbTvPJaL/TuB+MqYfg5lbD2UEELDmD1jzm/5ZWfpyVglcwQAq8tf8pSh3dAMi5hbqUXMPq6DGERKnqZuiVgRmFi3gYtUc6q3vhd42c7Kbhg6oGtGircI4hyGTBSpKy0yKoZ X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DB7PR04MB4505.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(396003)(136003)(346002)(39860400002)(366004)(376002)(451199021)(186003)(478600001)(6512007)(26005)(1076003)(6506007)(86362001)(2616005)(6666004)(316002)(83380400001)(38350700002)(38100700002)(6486002)(52116002)(66556008)(6916009)(66946007)(4326008)(66476007)(5660300002)(8676002)(8936002)(2906002)(41300700001)(36756003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: AiPkwcl2/AXWxebljS3rQyksE5j5PGRaDrCD+0tDk4xZROrVDgDOV1a+mskFOLv5V6LyuYCIofui8X6EJfNYDN8cJWyiS5azY71P+4NIJHAyDquHprBNB+QG8Rf0pEqu7WSTE8pTRbOqsPfUWz+q0Mra+wFzzHU8KUhSQSoR+QmPgEypZlEgTMG5RumxzbzaeLsWxWWFmeXAKWRxeQGu61ccr82GBrq9U0MEPa39x/DX8UwEstcnqWVhSww0mNFTLDvlNvMjWjp6NXH1SPRQ/JcaUm8QDyK434+iCNPQpzmoSRqza/HPpQ5tZHmTSqhBLmI1ExidCYagzt6VWsy3yZDvnsmi8TeLOTK7tRYl5i6DnnnKyxipJD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3SFbAdTK1S08QIcIIDgqJ9imscxhABch+yfnt68+cEgNCAZZaWjJgFvZq619hPIIJvCzjkcGP7s9nGT6PWnFC1Ej5B8xbaafkQY1F8qFw0MR/CwsQVOCcwcL70QZCGI9ANQ/v3fmwyRlsehDN05JG X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: d9709024-bb3f-4b2e-905c-08db7d3d102c X-MS-Exchange-CrossTenant-AuthSource: DB7PR04MB4505.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jul 2023 09:49:02.3700 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 9hfxe4srsUx9QW8p7qo/YI5tXRKpEpPg2fsCijirA8yxbo67OXBVV30Ky7KqlmsKI2zr42wPUkvKUhTXWFmW+g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: GV1PR04MB9087 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org 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: Signed-off-by: Xu Yang --- 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 986d6589f053..36b6e9fa7ffb 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,