From patchwork Fri Mar 17 06:15:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xu Yang X-Patchwork-Id: 13178563 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 09F1EC6FD1D for ; Fri, 17 Mar 2023 06:13:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229680AbjCQGN5 (ORCPT ); Fri, 17 Mar 2023 02:13:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48352 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229477AbjCQGNz (ORCPT ); Fri, 17 Mar 2023 02:13:55 -0400 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2063.outbound.protection.outlook.com [40.107.21.63]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CEDD7D538 for ; Thu, 16 Mar 2023 23:13:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RPsshA7hs2vhjYhrkTFuATnKOTAkoijZoTG+ReyBVmiffIAFil2XvdtFe7qjmWucXPYQ7qxiJdn17eNQLDUX4UQzUaD1whszjefMBo/NJJ7wvFLQdhf2QclxFgYwVldPxqKqmrE3d1ayT/H3duNHiQatV4j7rc7+yRuqjpr3lnAEAuli8wVV5PU9o6Sa31STKKIAvyBsNI/nXmh201jkcTLQsuxd4esKnkhepEe+YCxLq7DFqxOaJfvxIlXtD4xkr1YR0vgl7LGTuc4V4aMt4EsCd9DptGDk4MlXHkaxbuV2Wnl7uqjCkY2bvp47+yanza+MYCWh2gqzEHSbbDEHpw== 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=V8DrIXeZlDUTfGstEdQGon4yIw4bL7V+5etchI+9FV4=; b=ev8Wpg56WNqKcFcWkJ4EWWcO2eAoYYuufGYez64u0OV6NOrAJbBgY65QgA/I67IsJpU+I5cHTq2miVouhl8GpNd66iFNoJ8FB4LNcsN+Es3I9/RRYZaglAH3GBGWJ8AH50uu6w9gxMShe8yblklIbaonAkuEJszcVArAwAtnIdlFTJcgVut0Obk9KhXrPEfZWMP92iODAwg3G3kzaoYGEsYPvoaEtmNmhXyOfhQTl9CdPBtqVtkGrqrXqe6NksKrr1vbFCWemINndFDodUkkT02GQOxH4VVB3rzyre/5/ZWxV0/l1SOtMh4tP8U1pXTD+jWEZssLYaktTMBHtCV/Kw== 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=V8DrIXeZlDUTfGstEdQGon4yIw4bL7V+5etchI+9FV4=; b=C3eO2dFNUFC+iJl1JLormaUc9XJgf3gtPo6O6giMLiQbASCO+ETlOl8ZG9fie7O1IBJjBlV8xPrhGZbiOkE4tTfovvDBkvqZRUTOs8BMpC2VW6QyAxlk8gCg/xYtAyYrpq8t70641OAO1JkC+OSJYxb7nUF5lySMs2AAqMqeKDE= 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 DBAPR04MB7366.eurprd04.prod.outlook.com (2603:10a6:10:1a0::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.31; Fri, 17 Mar 2023 06:13:49 +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 06:13:49 +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 v3 1/2] usb: chipdea: core: fix return -EINVAL if request role is the same with current role Date: Fri, 17 Mar 2023 14:15:15 +0800 Message-Id: <20230317061516.2451728-1-xu.yang_2@nxp.com> X-Mailer: git-send-email 2.34.1 X-ClientProxiedBy: SI2PR01CA0009.apcprd01.prod.exchangelabs.com (2603:1096:4:191::18) To DB7PR04MB4505.eurprd04.prod.outlook.com (2603:10a6:5:39::26) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB7PR04MB4505:EE_|DBAPR04MB7366:EE_ X-MS-Office365-Filtering-Correlation-Id: 4dba8294-bbbb-425b-53e7-08db26aec61d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: MAN3ECxjYiqtEqG+abeYLigWrQb2XjLijpmnnL7/8SQf1DxzjWd6qXqjk9jCf5jAayUADZgk2YoniBF3nnetO7n2YV3CqSq20akZMIZJFq99q4Qqk3GfWAWDW5YOx00rfkE1mcPYnm6OlrUFsmpneP0zkdKAKJ/7RTq5Qtb1MtfvT3vKn3riaLh0YnP5Wz1G6AwgiDG+X3S9jFJRk4fLfpMUw2fcX18XSMjelpFmV5AJmBLHgjPpxU4cPAsl75vQzpZQdj2ztEZHHQ79kM02KmbZKxJg1ReNQbXfKYuCkSyjzFpPI9L9v6i2DgrwBNkvJez1G/jpyHTRkxvjQrlt98ZRw/ywKFHFYPXiTyeSBoR8uehRmE8PggWVLPTLmSOls2ZDqy6lLlTEUMmrqV+s0cg3cGjHiIjk/p4VY3Cx6cUboHf+7HOV50QtV+pC8Fqrxd6VZBH4nj15A+NnSgQca3ZGoo42jxVFXc5LEIBwNb8DuSrN5WyxfCxFfpd5QvQ59uORmYmjkN4HgN64sTzUA9tpcHcK8svRmdT2G19c3cI512tdo6QcR/IRTXjCGR7DZHqV1Js0z5QMM8vdGgsoUxx05pmfv6aZ0jia/otZvfue8d8LQEujxuaW2SeDNqPNtfrZQTRmRMDjD+WzOpAhP+jTPJy3ooDPgZvzJ2ZgdkcGhhNDa1usM2Xx8j679SwdpV5jVeBR34pjd9kCA0tJMg== 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)(346002)(376002)(136003)(39860400002)(396003)(366004)(451199018)(38350700002)(38100700002)(86362001)(4744005)(36756003)(2906002)(4326008)(41300700001)(5660300002)(8936002)(6916009)(1076003)(6512007)(186003)(26005)(2616005)(83380400001)(316002)(6506007)(66556008)(6486002)(8676002)(66946007)(6666004)(52116002)(66476007)(478600001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ewfRm3aYoqtrtA+dUNO16BAu7OrQHUv5XYupQQyiN7CHzEhbOC/64QrgbGXdY0SAsuwRNp6QGraEF0MIQxdDzeh1WOdVH6cPUkUw4OGGtYras5wZ6qhlA6kL1lhFErvNJKs2jAk2Iog5yM2ACOocDYmgtH/kHV2bLBep8CmOwqc0s3OPasRin9GHgz7GBCJaV3weYvcNSmm2QYFayih7qbrvtESXxyxx6T31C+XmN/rwcLQkB1fvwdgHSmhh/xM942NXzra7tEYgamrH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qsTmv9do+Xmvl0HM3EH8zdL4+9V8jdvrBGgI3u9SiRNyF/NRVHZhdowzWuzN6J/2OWRXDTRhCEdi7jlpHeDk3hDIOoDYIsdI+lxI3sKejSjy28Ok6nabNW7PRxdHu6skyPjFyD236n6o30sxiADr3yI+HACFYisJmw5PrE4VpC39Nb1U8k1A95mPBvkPHpMw+jHhVka8QVCcxjhmoKjmewGyT6V7ulHtdLUWpz8SKRV0Nbtyu+ X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4dba8294-bbbb-425b-53e7-08db26aec61d X-MS-Exchange-CrossTenant-AuthSource: DB7PR04MB4505.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Mar 2023 06:13:49.7251 (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: itowQ3umNyu/4dHIYzvEgOXV7WFM5xHpUmBAq6BxVAtiP1EFfchd10AiEGY0kwRBeRpzOyBT7rLvEW27Mns9HQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBAPR04MB7366 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 changes since v2: - add acked-by tag --- 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);