Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp906705rwi; Wed, 19 Oct 2022 04:35:31 -0700 (PDT) X-Google-Smtp-Source: AMsMyM57dl2gvWf34j4ldJ8moulHepHyn+hKLbMxyB8UAFloLbx9oqnkXr4nvjyWnHaeT3qjpU4a X-Received: by 2002:a17:903:40d1:b0:17f:4e94:b747 with SMTP id t17-20020a17090340d100b0017f4e94b747mr7739659pld.44.1666179320582; Wed, 19 Oct 2022 04:35:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666179320; cv=none; d=google.com; s=arc-20160816; b=KpAtpLkBGX56HmvHnPJP7O498BsTgD01AjM9lLHI95liv6Y/YX/I0nh5FmuyFd8NG6 MMmTuaV49W837ibPiQjcptnc1bh91WR8BhUDvrUjVpzV/HQ0usae6X069jE8Jf7WZFt6 1z/iN3EuBCInD55mkVwpGm+umQVVsAYLfj0+ruABfYh/QicGt3ZHMj7i8mR6zwTS6prB k/EFND2BAuTsiBCFkzeu1lT8ni6UX6m0lSzN6vOsQaLrusW4pluPu7lnFqkM6aRTypgw 4CpJxPvRU2GJzYfjaPQN5D5zV4EsU4sASeJmV+bC2BTX926dmFhL2w/Xz58DlZtB0P1a vKOw== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b10-20020a170902d88a00b00174e6274906si16602841plz.236.2022.10.19.04.35.07; Wed, 19 Oct 2022 04:35:20 -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 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 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); } } -- 2.35.1