From patchwork Fri Sep 29 23:58:46 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 9978905 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 270796034B for ; Sat, 30 Sep 2017 00:49:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 18E2A201F3 for ; Sat, 30 Sep 2017 00:49:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0D32120501; Sat, 30 Sep 2017 00:49:19 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 8244D201F3 for ; Sat, 30 Sep 2017 00:49:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=1wWZ+LV1eSKAFG7dWV8CDi1hY06pqbiuWbZkRMG1aTo=; b=cGo HPnUiNkUEG1OBaW3cI2CydfGk8Yega3pHHedbe9CRUncqaP06KjrgVt8HQ0AxndO5gJ63xWuA2YqF EUoIpUCbRHhBUyTEEu7mH8JKiTgDyEeOspwyOK2fWJ4Yt1DcvsiE7BEnfZZIPtqrK/ROu9+5DEdhl OuyCTvMuqHxDPk6yn68PbYj5ri0Q+OK2LKD8YJP6OjNPu7ERkhhaniHCiYNK2S0GM3gk0zp3ryklg YOx0AjASR2TBOrDfP9H3XY2DE3J+/cLhI1tM99SqNNQ83X/wyplqsgmeCNeOREB/MpePqu12b+umt XhJjTQaxD0AxR5ZRoZyPPf8sWHx3WNA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dy5xz-0006yj-2F; Sat, 30 Sep 2017 00:49:15 +0000 Received: from merlin.infradead.org ([2001:8b0:10b:1231::1]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dy5xw-0006yJ-QD for linux-rockchip@bombadil.infradead.org; Sat, 30 Sep 2017 00:49:13 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=Message-Id:Date:Subject:Cc:To:From: Sender:Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=R7B/v6t2aBuyeDsP7EaTmPiyKPgMP8tpToeDFJdT3JM=; b=VMkI7H44bX3djB8igNVQNdagN 6kIoNLGG2vkFjneza3dwOFuOTp/4eKhro19RBukJTDXCHLjB0UTVZIusJAXrHwOu3fx+vfJ6kfmum mJfOa3D+e9ZPM6kjTx9CptL3I5RvZpFqqc72AstdzJjOlkHpZoa5eL8R7O5X17VZRBjYbb2CzgnrL i0D5lSjp70eikJs9wW3ciabS+AejQFFto6nkz3xaEWDdrWFoIfc7tSdGSrMt3MO6AVlTXGvgyAFVP 98Fpbyxj1alVRREoLiqRwermUvUa407EW471LKAzKBF6aNWrVTI9DdVWC/U+cwcB24QCK1YnMU0w4 esCKSjPEQ==; Received: from mail-pg0-x22c.google.com ([2607:f8b0:400e:c05::22c]) by merlin.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dy5Bs-0000iy-Ka for linux-rockchip@lists.infradead.org; Fri, 29 Sep 2017 23:59:34 +0000 Received: by mail-pg0-x22c.google.com with SMTP id j70so559582pgc.10 for ; Fri, 29 Sep 2017 16:59:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id; bh=R7B/v6t2aBuyeDsP7EaTmPiyKPgMP8tpToeDFJdT3JM=; b=YG/79uhi2U5SpNvetX4RcUe0XLOoHtAya5/axHOx8QNRo02QsyYnj6mMsnz0pkYkeB MnsMyHWeEVkLyF7dpjS59H9AlH+h7zh+JZ1E//a+W3iTIKTrz8rRrT28r3L7VFkvhifA 3RnlhzXVFB8oAfqgLxGr4svyssYAheC+U6PJk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=R7B/v6t2aBuyeDsP7EaTmPiyKPgMP8tpToeDFJdT3JM=; b=FReyW+dOmN0+wJ+F5RuBoFVYURDIr2EZZAcz5KKSgp9UmRMhjO8WfRszCKrMBFJ0zG WPKBRzsZGp/DJDRODjzm/WaDrGMiwHyg0V1IJq01KS++HT/OKky6GFSU8PGES9V/GGA2 EH3KRrRtZ0xATwOwAtniRn2r4njXtBFNuxmRTM/uUbn4n2XslGHOYyVQFPwPFBUu9EDR ahqhHSIpFAZm3qm74pjybeqPqX9PLNtgRIQWdLozuFmI+7ht7yMactFJf6VGq9aVwWLP 8i2Bjtgu5uwrn+eQNpc4UJwK+TPqiEAi0kzftEYDXarfiU0Q/t9ikve0hKiNnK13KqAu AniQ== X-Gm-Message-State: AHPjjUjHOhQenc9rY3+k6tY6UhtT2eGBxS1lUSQgOhBsN/4foFIfs88h rgGPlV5zJNXJpPxNW5+jWXMzZQ== X-Google-Smtp-Source: AOwi7QBRiRbyD+p+HrLElTvRZ1+RCsrpg1XXvwhs30CEV9sBrdsBhkRYgJRaWVPtBahM0nHqDruCyA== X-Received: by 10.98.218.24 with SMTP id c24mr9173745pfh.289.1506729544998; Fri, 29 Sep 2017 16:59:04 -0700 (PDT) Received: from tictac.mtv.corp.google.com ([172.22.112.154]) by smtp.gmail.com with ESMTPSA id i189sm8254465pfg.159.2017.09.29.16.59.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 29 Sep 2017 16:59:03 -0700 (PDT) From: Douglas Anderson To: kishon@ti.com Subject: [PATCH] phy: rockchip-typec: Check for errors from tcphy_phy_init() Date: Fri, 29 Sep 2017 16:58:46 -0700 Message-Id: <20170929235846.1913-1-dianders@chromium.org> X-Mailer: git-send-email 2.14.2.822.g60be5d43e6-goog X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Heiko Stuebner , linux-rockchip@lists.infradead.org, Douglas Anderson , linux-kernel@vger.kernel.org, zyw@rock-chips.com, groeck@chromium.org, wulf@rock-chips.com, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP The function tcphy_phy_init() could return an error but the callers weren't checking the return value. They should. In at least one case while testing I saw the message "wait pma ready timeout" which indicates that tcphy_phy_init() really could return an error and we should account for it. Signed-off-by: Douglas Anderson Reviewed-by: Guenter Roeck --- drivers/phy/rockchip/phy-rockchip-typec.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/drivers/phy/rockchip/phy-rockchip-typec.c b/drivers/phy/rockchip/phy-rockchip-typec.c index 4d2c57f21d76..38831eebc934 100644 --- a/drivers/phy/rockchip/phy-rockchip-typec.c +++ b/drivers/phy/rockchip/phy-rockchip-typec.c @@ -685,8 +685,11 @@ static int rockchip_usb3_phy_power_on(struct phy *phy) if (tcphy->mode == new_mode) goto unlock_ret; - if (tcphy->mode == MODE_DISCONNECT) - tcphy_phy_init(tcphy, new_mode); + if (tcphy->mode == MODE_DISCONNECT) { + ret = tcphy_phy_init(tcphy, new_mode); + if (ret) + goto unlock_ret; + } /* wait TCPHY for pipe ready */ for (timeout = 0; timeout < 100; timeout++) { @@ -760,10 +763,12 @@ static int rockchip_dp_phy_power_on(struct phy *phy) */ if (new_mode == MODE_DFP_DP && tcphy->mode != MODE_DISCONNECT) { tcphy_phy_deinit(tcphy); - tcphy_phy_init(tcphy, new_mode); + ret = tcphy_phy_init(tcphy, new_mode); } else if (tcphy->mode == MODE_DISCONNECT) { - tcphy_phy_init(tcphy, new_mode); + ret = tcphy_phy_init(tcphy, new_mode); } + if (ret) + goto unlock_ret; ret = readx_poll_timeout(readl, tcphy->base + DP_MODE_CTL, val, val & DP_MODE_A2, 1000,