From mboxrd@z Thu Jan 1 00:00:00 1970 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 EB387C76196 for ; Mon, 3 Apr 2023 14:21:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233044AbjDCOVG (ORCPT ); Mon, 3 Apr 2023 10:21:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41436 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233048AbjDCOUz (ORCPT ); Mon, 3 Apr 2023 10:20:55 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6144F2D7DD for ; Mon, 3 Apr 2023 07:20:30 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id F281ACE12BD for ; Mon, 3 Apr 2023 14:20:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F2D04C433D2; Mon, 3 Apr 2023 14:20:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1680531625; bh=jfqSmcs6eeBcUxR3Hcw8u6iVG/WGCLmO5QOcJrJ/Txk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kqXYE1f7UU2r44cEBEzy6d1EPMgVz2Lx6XTUwrV9Enl6LoyYLCp1dQBB+nItGOmM/ tYQSMfLZk81mA+Fz/7bawUxRStKW0UqvsUmGEab1m6ZRsHz0jCY2wyVJrTUW9Juu1v UY6wi9J8GfcrBRWAYfc66YXGqog+m17FzAzSUqkg= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Peter Chen , Xu Yang Subject: [PATCH 5.4 049/104] usb: chipdea: core: fix return -EINVAL if request role is the same with current role Date: Mon, 3 Apr 2023 16:08:41 +0200 Message-Id: <20230403140406.283567926@linuxfoundation.org> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230403140403.549815164@linuxfoundation.org> References: <20230403140403.549815164@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Xu Yang commit 3670de80678961eda7fa2220883fc77c16868951 upstream. 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 Link: https://lore.kernel.org/r/20230317061516.2451728-1-xu.yang_2@nxp.com Signed-off-by: Greg Kroah-Hartman --- drivers/usb/chipidea/core.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) --- a/drivers/usb/chipidea/core.c +++ b/drivers/usb/chipidea/core.c @@ -960,9 +960,12 @@ static ssize_t role_store(struct device 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);