From patchwork Wed Oct 19 08:29:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 5115 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp250978wrs; Wed, 19 Oct 2022 03:50:30 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6/zDd4RAHH7qqx9H1RQhkDeaKa2CRN4lGbXjIGByxqaD0ONFKoCBiDW8vV04Fu2JnJoKKk X-Received: by 2002:a17:906:8457:b0:78d:b793:5511 with SMTP id e23-20020a170906845700b0078db7935511mr6101797ejy.393.1666176630505; Wed, 19 Oct 2022 03:50:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666176630; cv=none; d=google.com; s=arc-20160816; b=Imv0vcNtReT4BXBIY8WiHW7HZqG3vI44QUvocn72uJo+tknV6Y6X0UjG+JRNE9nF/S xerUpHYxcpmvqt5HtIeEpxkvjnObapWYejUMytXQTcDggMSix18yXBAsqReiG9LnfhAq 9vN6X7mD39rmRdxN2w+RNd9Qje+Y2QnCS1LYRGpMFqWws0EvGuS617PzGuBW+khzIDE8 ndgPL17Whd7qLBPtAlLACI0Tm5VrWcwPGxXmRGfKL6t08hhTrxWrQOI1CipI8Nq0Oj2O jw15SGazL46ifugGAQbyvuWf+4yKQYQuP5bcMOkPzeTj/kwB/dOyYSEKVung+iKQ9IjM fLmw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=FCwzk50Jojn3egVS12KPj3vqvDLZq24zeyLTpKKDGdE=; b=eMssYBLFsBFUgRDEKe4QhSNVpvyPhS8pIGZqXXAtwHR8aOn4StVwe4b99ex6pbieLh nyALuCLh9YvLeeWreY7XmQKXLNLvmn+9osjRbmdg3HbBh8Yq/ALDP5ZKG3cN7YdHnpM4 +zqD+RCrSNu+KJBLuI121iRPZxjXuQvWygWr48Lv60OiGeOxMWUQX0hGDnYBMRxPguav uGBrRE0k3h08q2xfvj9pqDNk3CSnEv+f1elkqT9MH2EL83K2zXDbiwzLJ7iRfA6dr03B th8dQdkSVMWZoVxrrmaNeW88gbXM99BafDK/ozTqfWF8sm8prf2v9zs2OkCZORbQ2GPj owWQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=kN4LESQP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j9-20020a05640211c900b0045db850a506si6230438edw.46.2022.10.19.03.50.04; Wed, 19 Oct 2022 03:50:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=kN4LESQP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234347AbiJSKsw (ORCPT + 99 others); Wed, 19 Oct 2022 06:48:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54134 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233413AbiJSKqp (ORCPT ); Wed, 19 Oct 2022 06:46:45 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E09E215A32C; Wed, 19 Oct 2022 03:21:38 -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 ams.source.kernel.org (Postfix) with ESMTPS id 3297FB8245F; Wed, 19 Oct 2022 09:00:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 91372C433C1; Wed, 19 Oct 2022 09:00:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170045; bh=ARqMNczG9AC7cTclunG4sGzC2KLFxA0jYdI0tZNSQo0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kN4LESQPz9uxwFljqq1zsC9Rqv2DUWjGn8+HBuDSqkf74J6gi3aPimzKC3+hDZZtk 7nQrIqOl5ud9C6EEOXo2kW4qNaiiXD5K4V0Uc6xuYn/6dCirqIgMv4eYCt0a4D+Xls dwDZRjJ1xk8G4Q/MjkZ+SQnYpBUQrtynwZImKCSk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Markus Reichl , Michael Riesch , Peter Geis , Samuel Holland , Vinod Koul , Sasha Levin Subject: [PATCH 6.0 506/862] phy: rockchip-inno-usb2: Return zero after otg sync Date: Wed, 19 Oct 2022 10:29:53 +0200 Message-Id: <20221019083312.345036441@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747112826265523617?= X-GMAIL-MSGID: =?utf-8?q?1747112826265523617?= From: Peter Geis [ Upstream commit f340ed8664a55a467850ec1689996e63d9ee971a ] The otg sync state patch reuses the ret variable, but fails to set it to zero after use. This leads to a situation when the otg port is in peripheral mode where the otg phy aborts halfway through setup. It also fails to account for a failure to register the extcon notifier. Fix this by using our own variable and skipping otg sync in case of failure. Fixes: 8dc60f8da22f ("phy: rockchip-inno-usb2: Sync initial otg state") Reported-by: Markus Reichl Reported-by: Michael Riesch Signed-off-by: Peter Geis Tested-by: Michael Riesch Tested-by: Markus Reichl Reviewed-by: Samuel Holland Link: https://lore.kernel.org/r/20220902184543.1234835-1-pgwipeout@gmail.com Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin --- drivers/phy/rockchip/phy-rockchip-inno-usb2.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c index 0b1e9337ee8e..e6ededc51523 100644 --- a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c +++ b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c @@ -1124,7 +1124,7 @@ static int rockchip_usb2phy_otg_port_init(struct rockchip_usb2phy *rphy, struct rockchip_usb2phy_port *rport, struct device_node *child_np) { - int ret; + int ret, id; rport->port_id = USB2PHY_PORT_OTG; rport->port_cfg = &rphy->phy_cfg->port_cfgs[USB2PHY_PORT_OTG]; @@ -1162,13 +1162,15 @@ static int rockchip_usb2phy_otg_port_init(struct rockchip_usb2phy *rphy, ret = devm_extcon_register_notifier(rphy->dev, rphy->edev, EXTCON_USB_HOST, &rport->event_nb); - if (ret) + if (ret) { dev_err(rphy->dev, "register USB HOST notifier failed\n"); + goto out; + } if (!of_property_read_bool(rphy->dev->of_node, "extcon")) { /* do initial sync of usb state */ - ret = property_enabled(rphy->grf, &rport->port_cfg->utmi_id); - extcon_set_state_sync(rphy->edev, EXTCON_USB_HOST, !ret); + id = property_enabled(rphy->grf, &rport->port_cfg->utmi_id); + extcon_set_state_sync(rphy->edev, EXTCON_USB_HOST, !id); } }