From patchwork Thu May 24 07:23:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 10422961 X-Patchwork-Delegate: bhelgaas@google.com 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 248DF60545 for ; Thu, 24 May 2018 07:23:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0FF9429012 for ; Thu, 24 May 2018 07:23:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 04DC529016; Thu, 24 May 2018 07:23:43 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B30BF29012 for ; Thu, 24 May 2018 07:23:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935652AbeEXHXl (ORCPT ); Thu, 24 May 2018 03:23:41 -0400 Received: from mail-wm0-f65.google.com ([74.125.82.65]:50528 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935605AbeEXHXj (ORCPT ); Thu, 24 May 2018 03:23:39 -0400 Received: by mail-wm0-f65.google.com with SMTP id t11-v6so2180276wmt.0; Thu, 24 May 2018 00:23:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=DyPlIi4Ywkd/ObZcL9NeUKW1y8mnQUHBPSDvnJCTobQ=; b=uIN7kD1wWaj4dwQpUp9IMjxKpbnVPWzf9+vbKfY64A0ycF/ax8tkvVbEKNtmg3A6Ce MYP9apLS2ivARLxKgkyff7CAhj/bpwjcWnb/UfpAeGKuLf+gOh3vAEKI0j+ouwykrFHr kmF1wVrj/TX3bCRx2+MF32MNBtFtwk4rYRNUW+2q5oExryZJsIRmbx2HfMlVIPNxa/ys HKXFV/8Ee2SE/UHyVxiio5V7a2NahbE5sRxicEzfVVbLRbrlJ4B91xwtmFxI1gs4SLMw LX3RMGnXafelsmaWutyM/LnKszZhlB5r9M+Bxane/i5orho5Eu305n0uUsc9blB4LBNt +9WA== 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:in-reply-to :references; bh=DyPlIi4Ywkd/ObZcL9NeUKW1y8mnQUHBPSDvnJCTobQ=; b=hb+Pyx5baIEuQ7Aeqopa9HGQiTrmgDJIXYH51OB65ANJXA6pChaLZLci/L9vQiGlYw Rq9UZT3N579i/Gi7V6FPW20rbpgYph27fUx9MYNq2yelqqQUPDU07FBev7r1XjUR2hZ+ qpsVYaGCFt/17QaJZz9tOO6g+R2jhEE4xaW8ZLINJuMoaQO7HHuWOcKyF75qI+k0qqSj 8a41pjolfNb3RA31DcV3Ui2Y+pnJrNVIyKvNwnbIHKTGcem0B3DbPqfsLrWH7W5O2F7d ScQyx+vjHZRoxtxn0cLNRumPdVJoySZHaUm9kqQxdjT5pSG9ZrjUQClHD7rsSd5si/Or WvRg== X-Gm-Message-State: ALKqPwd6faLxB4xEPXzveQ6QNgxHKFGq3HFMSzHAf036GsnkPHOeMykg BrqtkmPCOymB8f0RP9pgk39R9TEF X-Google-Smtp-Source: AB8JxZoFhxyl/YEFU2WiBi5HjamG7rrZEKaTbb5t1rDuR86yDzzCbtathRLE1Y72NJ2AU3OQe8vqQw== X-Received: by 2002:a1c:c588:: with SMTP id v130-v6mr5750463wmf.135.1527146618287; Thu, 24 May 2018 00:23:38 -0700 (PDT) Received: from kurokawa.lan (ip-86-49-107-50.net.upcbroadband.cz. [86.49.107.50]) by smtp.gmail.com with ESMTPSA id j13-v6sm10997919wre.38.2018.05.24.00.23.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 24 May 2018 00:23:37 -0700 (PDT) From: Marek Vasut X-Google-Original-From: Marek Vasut To: linux-pci@vger.kernel.org Cc: Marek Vasut , Geert Uytterhoeven , Phil Edworthy , Simon Horman , Wolfram Sang , linux-renesas-soc@vger.kernel.org Subject: [PATCH 6/6] PCI: rcar: Shut the PHY down in failpath Date: Thu, 24 May 2018 09:23:23 +0200 Message-Id: <20180524072323.22115-6-marek.vasut+renesas@gmail.com> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180524072323.22115-1-marek.vasut+renesas@gmail.com> References: <20180524072323.22115-1-marek.vasut+renesas@gmail.com> Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP If anything fails past phy_init_fn() and the system is a Gen3 with a PHY, the PHY will be left on and inited. This is caused by the phy_init_fn, which is in fact a pointer to rcar_pcie_phy_init_gen3() function, which starts the PHY, yet has no counterpart in the failpath. Add that counterpart. Signed-off-by: Marek Vasut Cc: Geert Uytterhoeven Cc: Phil Edworthy Cc: Simon Horman Cc: Wolfram Sang Cc: linux-renesas-soc@vger.kernel.org Fixes: 517ca93a7159 ("PCI: rcar: Add R-Car gen3 PHY support") --- drivers/pci/host/pcie-rcar.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/pci/host/pcie-rcar.c b/drivers/pci/host/pcie-rcar.c index 636c3c5095d2..695781934f0a 100644 --- a/drivers/pci/host/pcie-rcar.c +++ b/drivers/pci/host/pcie-rcar.c @@ -1163,7 +1163,7 @@ static int rcar_pcie_probe(struct platform_device *pdev) if (rcar_pcie_hw_init(pcie)) { dev_info(dev, "PCIe link down\n"); err = -ENODEV; - goto err_clk_disable; + goto err_phy_shutdown; } data = rcar_pci_read_reg(pcie, MACSR); @@ -1175,7 +1175,7 @@ static int rcar_pcie_probe(struct platform_device *pdev) dev_err(dev, "failed to enable MSI support: %d\n", err); - goto err_clk_disable; + goto err_phy_shutdown; } } @@ -1189,6 +1189,12 @@ static int rcar_pcie_probe(struct platform_device *pdev) if (IS_ENABLED(CONFIG_PCI_MSI)) rcar_pcie_teardown_msi(pcie); +err_phy_shutdown: + if (pcie->phy) { + phy_power_off(pcie->phy); + phy_exit(pcie->phy); + } + err_clk_disable: clk_disable_unprepare(pcie->bus_clk);