Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp2267753pxb; Sun, 17 Oct 2021 10:05:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy+s0dA3iJfyJpsqdpizAXMD0qN2dWwJcbiL1ZUd87xKwKW8ZT1V1ol7sJsqMfTiH5pFLSR X-Received: by 2002:a63:4743:: with SMTP id w3mr18626175pgk.245.1634490304173; Sun, 17 Oct 2021 10:05:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634490304; cv=none; d=google.com; s=arc-20160816; b=mrtUqJ3+Txy57zCyx/qrN34wQ7yX93sbJhgrkZTLpv4jvHN3yvOSoMZlBr3Lz5OQHi /zAdefy1b4bc5yj2DQ0408dt9VF4XTMHAEDMaWfRS9kLeGFkR7ijZi+0bmlJF1x+3gn9 2411PKOrOFLP7UK+TJa/JQVgXOyTRvJxW5QXi01N3rHI1XA7XbvdQPylyz3vVGDxLTs2 NmrzGvm2uQ8/KTjczB2mUwu5p/iDyS87bkFSqARspaNzAjpw8dB16dNTWMd0oM1VvQLF khEWcWB4Xeorsllkdjj4NT84wDMuiJPlvLwPwuY8haJsEq9fy7I4DIiLBxYgzst0efIw 47pQ== 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:date:cc:to:from:subject :message-id; bh=0nTHOm+5H0qQJkNZmUQAitWswpC02dgDOqdJV9UaYls=; b=uM8T5tetiXmTiD/8trUDYU1UYoxrq5XIGTBOZLF7K/M9td76EhCyxZnbaFRcYaKhh5 4DxDabDfk8rf1hviVrBQgA41t1kmd0sbkMo2YasyhQ3bh9614s8R4bFD7aFmmQmfaJyr VHH0bqcNeu96o7SFU5DyC5IyNgmg2+sl+G/ptnX+Nihgm7yFBRj74q0XCjKO4GaikY9/ 9IiriocgXJBJ5rSeydybfzU53CFZaPkdvoPucjoDQd0IaX54+OZSNEq+PdV0h2xW+98r xYhJJRDZ8qhO+MCLdP+JlXCurIDyIDty0d7Xa5dV9ABXZ9SX3+nEuD1Fn0RxUt5gOdUc 7Wzg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id kb13si6368379pjb.136.2021.10.17.10.04.51; Sun, 17 Oct 2021 10:05:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242548AbhJOSS1 (ORCPT + 99 others); Fri, 15 Oct 2021 14:18:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52656 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237653AbhJOSS1 (ORCPT ); Fri, 15 Oct 2021 14:18:27 -0400 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 613F9C061570 for ; Fri, 15 Oct 2021 11:16:20 -0700 (PDT) Received: from gallifrey.ext.pengutronix.de ([2001:67c:670:201:5054:ff:fe8d:eefb] helo=[IPv6:::1]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mbRkc-0000pL-Fg; Fri, 15 Oct 2021 20:16:14 +0200 Message-ID: <6c2cd328dfd407002339d1c83ebd5b832d4f377d.camel@pengutronix.de> Subject: Re: [RESEND v2 2/5] PCI: imx6: Add the error propagation from host_init From: Lucas Stach To: Richard Zhu , bhelgaas@google.com, lorenzo.pieralisi@arm.com Cc: linux-pci@vger.kernel.org, linux-imx@nxp.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, kernel@pengutronix.de Date: Fri, 15 Oct 2021 20:16:13 +0200 In-Reply-To: <1634277941-6672-3-git-send-email-hongxing.zhu@nxp.com> References: <1634277941-6672-1-git-send-email-hongxing.zhu@nxp.com> <1634277941-6672-3-git-send-email-hongxing.zhu@nxp.com> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.40.4 (3.40.4-1.fc34) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-SA-Exim-Connect-IP: 2001:67c:670:201:5054:ff:fe8d:eefb X-SA-Exim-Mail-From: l.stach@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Am Freitag, dem 15.10.2021 um 14:05 +0800 schrieb Richard Zhu: > Since there is error return check of the host_init callback, add error > check to imx6_pcie_deassert_core_reset() function, and change the > function type accordingly. > > Signed-off-by: Richard Zhu Reviewed-by: Lucas Stach > --- > drivers/pci/controller/dwc/pci-imx6.c | 24 ++++++++++++++++-------- > 1 file changed, 16 insertions(+), 8 deletions(-) > > diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c > index 1fa1dba6da81..3372775834a2 100644 > --- a/drivers/pci/controller/dwc/pci-imx6.c > +++ b/drivers/pci/controller/dwc/pci-imx6.c > @@ -527,24 +527,24 @@ static void imx7d_pcie_wait_for_phy_pll_lock(struct imx6_pcie *imx6_pcie) > dev_err(dev, "PCIe PLL lock timeout\n"); > } > > -static void imx6_pcie_deassert_core_reset(struct imx6_pcie *imx6_pcie) > +static int imx6_pcie_deassert_core_reset(struct imx6_pcie *imx6_pcie) > { > struct dw_pcie *pci = imx6_pcie->pci; > struct device *dev = pci->dev; > - int ret; > + int ret, err; > > if (imx6_pcie->vpcie && !regulator_is_enabled(imx6_pcie->vpcie)) { > ret = regulator_enable(imx6_pcie->vpcie); > if (ret) { > dev_err(dev, "failed to enable vpcie regulator: %d\n", > ret); > - return; > + return ret; > } > } > > - ret = imx6_pcie_clk_enable(imx6_pcie); > - if (ret) { > - dev_err(dev, "unable to enable pcie clocks\n"); > + err = imx6_pcie_clk_enable(imx6_pcie); > + if (err) { > + dev_err(dev, "unable to enable pcie clocks: %d\n", err); > goto err_clks; > } > > @@ -599,7 +599,7 @@ static void imx6_pcie_deassert_core_reset(struct imx6_pcie *imx6_pcie) > break; > } > > - return; > + return 0; > > err_clks: > if (imx6_pcie->vpcie && regulator_is_enabled(imx6_pcie->vpcie) > 0) { > @@ -608,6 +608,7 @@ static void imx6_pcie_deassert_core_reset(struct imx6_pcie *imx6_pcie) > dev_err(dev, "failed to disable vpcie regulator: %d\n", > ret); > } > + return err; > } > > static void imx6_pcie_configure_type(struct imx6_pcie *imx6_pcie) > @@ -858,11 +859,18 @@ static int imx6_pcie_start_link(struct dw_pcie *pci) > static int imx6_pcie_host_init(struct pcie_port *pp) > { > struct dw_pcie *pci = to_dw_pcie_from_pp(pp); > + struct device *dev = pci->dev; > struct imx6_pcie *imx6_pcie = to_imx6_pcie(pci); > + int ret; > > imx6_pcie_assert_core_reset(imx6_pcie); > imx6_pcie_init_phy(imx6_pcie); > - imx6_pcie_deassert_core_reset(imx6_pcie); > + ret = imx6_pcie_deassert_core_reset(imx6_pcie); > + if (ret < 0) { > + dev_err(dev, "pcie host init failed: %d.\n", ret); > + return ret; > + } > + > imx6_setup_phy_mpll(imx6_pcie); > > return 0;