From patchwork Fri Mar 17 05:52:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xu Yang X-Patchwork-Id: 13178543 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 74848C74A5B for ; Fri, 17 Mar 2023 05:50:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229693AbjCQFuP (ORCPT ); Fri, 17 Mar 2023 01:50:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48334 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229523AbjCQFuM (ORCPT ); Fri, 17 Mar 2023 01:50:12 -0400 Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-vi1eur04on2079.outbound.protection.outlook.com [40.107.8.79]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B0AFC1ADE1 for ; Thu, 16 Mar 2023 22:50:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=luRYPZ3zcrA9WTkRNlEFiBib82TxYw/E54kc4nXxg0LZXkAHlPjPTVVUipmnuJfVLBemOGBo2UQdvhrCYbPKGG3QdiWNYnVceqrHCyz5o1IT/D9zcv3HkXc/onlzmRlLrfKMU3o37eU7lnPs1Wz0JzXA0VIe4t09+uLpl8l5xy4jje25eHwmKtfjaseDq7zKsqUlDV0cIm8G0eZpNNT3MDHHtggfTye8JNCKhGlJzp8BbL7tsV57bnAt/H+OzzF5MFI6Gz9dyM4iiTrWpvIjGhKsCb4JC83S/ZXHAadmPyNmU7CF80I99gz3nbRb7pQdW3909jVcBa6UantzVEDh1Q== 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=Aa0jrAlIfFnp1eQHifxu8upj210L829UF6/5n83kDOc=; b=oOl/0loz+QGCSWkWQxNDNyc0eEvqUDmuwxygr+x4D2P9ZtDepHIqvb9eh68uOstTrexRrccozeTVvZFzVLMAvqt3uajrvNhhv/NOJC483e5j1Kj/Y/c58/YdIMzuPf08hqO6F2Ym7pzAUoJhaku7h6+zIo0XuLJbwnwXkjuhGli8QYh1xuL8Y5bmYVtsmbzZODjnghzUsIBXcQ1GuPutAM/41sqJa+jm2fjQqDC6o4ValW0ysoPnqbMjlDjXcy2e10px6Epr2p01GCEZblvz6ft7JuitehF7qxDBMWxwD4ytPEPxH0zlwJvNHj7d+YePOSzKovqQ6UsmbLp2EXY4Uw== 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=Aa0jrAlIfFnp1eQHifxu8upj210L829UF6/5n83kDOc=; b=Qqx82XPaezyXYoSxGo8fk6+NU9mfnu80pc3QFeqCFf0m9CbjEKBO1XwgXZh9aO6XDwn5HzEVS1wkCrNOt3009MtTBRGp9a/L38PKruQ8KCoFWiX4E7FNzl8gqIuevIYNo9O7cvETQScjIrQbkPEC5PVYgvONlMUihjXq4LEcpas= 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 VI1PR04MB7088.eurprd04.prod.outlook.com (2603:10a6:800:11d::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.35; Fri, 17 Mar 2023 05:50:01 +0000 Received: from DB7PR04MB4505.eurprd04.prod.outlook.com ([fe80::5466:bfa2:3158:97c6]) by DB7PR04MB4505.eurprd04.prod.outlook.com ([fe80::5466:bfa2:3158:97c6%3]) with mapi id 15.20.6178.035; Fri, 17 Mar 2023 05:50:01 +0000 From: Xu Yang To: peter.chen@kernel.org Cc: gregkh@linuxfoundation.org, linux-usb@vger.kernel.org, linux-imx@nxp.com, jun.li@nxp.com, xu.yang_2@nxp.com Subject: [PATCH RESEND v2 1/2] usb: chipdea: core: fix return -EINVAL if request role is the same with current role Date: Fri, 17 Mar 2023 13:52:01 +0800 Message-Id: <20230317055203.2366868-1-xu.yang_2@nxp.com> X-Mailer: git-send-email 2.34.1 X-ClientProxiedBy: SG2PR02CA0109.apcprd02.prod.outlook.com (2603:1096:4:92::25) To DB7PR04MB4505.eurprd04.prod.outlook.com (2603:10a6:5:39::26) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB7PR04MB4505:EE_|VI1PR04MB7088:EE_ X-MS-Office365-Filtering-Correlation-Id: b9bd702c-5306-4acd-c7ba-08db26ab730d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: oujnVhEaAA2rpRdSrTPesmFKw+wHiPAcQ34VeJqJdhDdKrGjzStnLi8WtEtcoYCEe5B6TFDo6PcF1bmXeke10QFSnsvgip2qafwz8QXGpOB3Kzdjv2rppE/yFAtsr3YZCG1pcvhsGxp5FGPCgePk/Srp0cDPeqZ6iuTH9Si2tFSV/Sum1loqC7wBR166w/6f9+IIeJBsJgU04azX6zRojQH1pboZMzV1gTcF1qK3V6ISKea6+gn4yViODhueYk6qwizySUNgt5gzDbE2f7/4JdcvPN4Jul2PDnDMXuxLl6GK6FXuRGh4dm8ckAniu7/oEtKFj3XH4Aq6lAKg5HcpMCViKZZy8eixOM8DeH/K9wesZAvh2yi5Rn6I8YUCCSFxuAs7VVvPMFz7i8nj7j/suFG83Ho2/1yEvQpTQiGBNwJW2BEN8A9iRRmjXcHYWCekn6gvwvJsdLRlLl17dlTQQqLaroiXVWRnYjLtwdM88C45aurhND1aoWVy6Y/8Nc61Fun+MBSgQOm+rLhrPPoFPABprOKkfNdtKLH80xsMOmeox/vOitos0F4SkmYjUSZ243Spuy8fBLX2Q57zdkuykX7Ae03AudELQbuaSkiTuLrP0gGhiL6hlGD4dkc5QUclIhZWhEergCuIoessdspqz4Ybrmm/K2OTMs/7A3YXjhXJ37UBG3phmX9wwUOSKJjqvLOXb1Ci6N+Zg/rUP90nqw== 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:(13230025)(4636009)(136003)(366004)(376002)(346002)(39860400002)(396003)(451199018)(8936002)(6486002)(52116002)(66946007)(8676002)(66476007)(66556008)(4326008)(6916009)(186003)(41300700001)(1076003)(6506007)(6512007)(2616005)(36756003)(26005)(2906002)(4744005)(86362001)(478600001)(316002)(38100700002)(38350700002)(5660300002)(83380400001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: UYrpW70yYH6lguvTC10EEPxYYnAHcAhYaN27Jx//BdBD9ZrhLzULUO/C93YqTZgE3RglKdGHtlFo1MgVM1IgD7/X7NCHThxD4g3bc7C2jMM1EwtO0lANz9GEtk4u+93js+c3XGuo89GvLjBx2jAytuxFnTbAqRPxPv8Q8Cp14DaFAPhRKBjtBEAiXTC1CPvLtmJChcs65QX+XG1x6l8PUfAjAJLczcD3JrzO26pLjHVzT+tF6WuEnf7ug0rGR9YhqWYnOcEMzwdjti20rdm5CvxatsrnUG0Tu7Xk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irdA3yOaWGS5BTf0Py/8RpqDPC/lTGvmUG0uq0lbjKMLoobprgCPH6qfF6npw2xYI7DjgejJO8S+dS+sKX761IB3bg6ribNVvMxXMieRBEzvz5xgUUc7ujWbQq1fAuHxczk55W7gbAbbL21t4co+B3DY4V3XgCBqEYRCkxqT5bsUpRfVv+IMB6U7VuUMCDPBBF5ja1Rrfp7hxwlrGqAiSNlWyx8KMg9W8zwc1TMIGoAKLUN1OT X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: b9bd702c-5306-4acd-c7ba-08db26ab730d X-MS-Exchange-CrossTenant-AuthSource: DB7PR04MB4505.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Mar 2023 05:50:01.8040 (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: i8zbR+12+Oc4/3CgyiAYehZ2MONFqfLZ9cTGCm/s1ff17ye0EPWNCrMAV0HljUkFVWL2v9ujWRcWnrFXehQC7w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB7088 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org It should not return -EINVAL if the request role is the same with current role, return non-error and without do anything instead. Fixes: a932a8041ff9 ("usb: chipidea: core: add sysfs group") cc: Acked-by: Peter Chen Signed-off-by: Xu Yang --- changes since v1: - no change --- drivers/usb/chipidea/core.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c index 7ccb223ed53c..eae4bf865a8e 100644 --- a/drivers/usb/chipidea/core.c +++ b/drivers/usb/chipidea/core.c @@ -984,9 +984,12 @@ static ssize_t role_store(struct device *dev, strlen(ci->roles[role]->name))) break; - if (role == CI_ROLE_END || role == ci->role) + if (role == CI_ROLE_END) return -EINVAL; + if (role == ci->role) + return n; + pm_runtime_get_sync(dev); disable_irq(ci->irq); ci_role_stop(ci);