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: 9978907 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 842216034B for ; Sat, 30 Sep 2017 00:49:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 731F32989A for ; Sat, 30 Sep 2017 00:49:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 67B192989D; Sat, 30 Sep 2017 00:49:39 +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 EB63A2989A for ; Sat, 30 Sep 2017 00:49:38 +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=3c5YMl0rB9u9HcwSVSIWvjVZPHfHQXCtqBAba36obEo=; b=FHN gYKUmM98eFcJdbtASOEFxrR+CFXBA5xpTFIpD3oRSeRJPmXpY9kIXbndoM/g6P5a0fbjPHmRX2dWf eZiROkU9R0697+KD0yFNml10lcbPpHverfztsAqFSjDIsaep0IVaDeS7XVH7cBqCd+bpj7P/x+gtz JSO2ssnCiPoiNwnGcDcTg0qSwFCwk4N9cGUpUVljtV6SaTjNsdi1IQGvxSHJw+CAy2JprwbHMNI5i quzQTZRHTShmZoEAjOqhFk0cb8MTt/me2CahNONbfikgvjWpHCVYAEcRfYonx0pZNlNhdsLGwI66k digFFzjTR7u/sRNwr7HsMb5nD9fsIHA==; 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 1dy5y6-00071K-Sl; Sat, 30 Sep 2017 00:49:22 +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 1dy5y4-0006yJ-DU for linux-arm-kernel@bombadil.infradead.org; Sat, 30 Sep 2017 00:49:20 +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-x234.google.com ([2607:f8b0:400e:c05::234]) by merlin.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dy5Bs-0000ix-L7 for linux-arm-kernel@lists.infradead.org; Fri, 29 Sep 2017 23:59:34 +0000 Received: by mail-pg0-x234.google.com with SMTP id k193so561528pgc.8 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=nY/G3QY+JOh8x2fdqVK9zpQ7GttMiiA4CQgggC81V78mCtJpRqoq+cK+d+ErtUrwH0 SbovPuz4NxvHr72dTQSgnrARgDUGEYBzYjQxdvnZEwqsNENnCblHXw3grHnqaxtw3R7k qCHWEe7EbCNWwi1XgtOul3Q/VN1a1ytjhwbPVxHoXzDH8xuMC2eVnOy00lfryT/CkPH4 rIcb40BiWPS8zI5+RbzNYxHh4upBDekT3DtRntjTwlHa/9FegiZLRBVKVzv5YYdpe3Vk LibhYCPfAS0JYn9BHzzqu1/5DKAOki/wTZtbQaGDJp94U+KWMe1yHNeghvTRP7hSOlzj /CKg== X-Gm-Message-State: AHPjjUgjAg+FM9sTeMWFSFs2g0tqi8t2PHKWY2gAFMJxtQcIHCrNs1RS zc9gMQnJFpSmy+/6AjYCnGJfyA== 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-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: 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-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=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,