From patchwork Fri May 25 18:33:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 10428243 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 D59D5602D8 for ; Fri, 25 May 2018 18:34:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C70C329758 for ; Fri, 25 May 2018 18:34:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BBA1229751; Fri, 25 May 2018 18:34:09 +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 74C2D29758 for ; Fri, 25 May 2018 18:34:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S967680AbeEYSeI (ORCPT ); Fri, 25 May 2018 14:34:08 -0400 Received: from mail-wr0-f196.google.com ([209.85.128.196]:40526 "EHLO mail-wr0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S967628AbeEYSeH (ORCPT ); Fri, 25 May 2018 14:34:07 -0400 Received: by mail-wr0-f196.google.com with SMTP id l41-v6so10762116wre.7; Fri, 25 May 2018 11:34:07 -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; bh=3z6cuT+04YEJ35PlAKast9jdeih6eajuJ/oJXRUxgfI=; b=In+NLVhmGClPHHNdWISOLH8n0XUQVHveU+7HbrCwr8lJXiV/PND0ndrwtWaH4uhanu u/udS4n9e3O3yTlf6bXbEGScSU0qM107stdQPPQ1Rzghft7tVXEauduXvZKq/WwKdsan uWQu005sHaf8jhbX2Ja8+/c0DUHZxR7J6xlgzrQIBDsl2QX6ediHCTy26hmTjpqNLDun vOP6TEur1RnnyE9eCXtDBXZ2hJY9zSPuzzzwDkG+EVDEXuDNH1YP97UCT0VRojxPCpct FwWs7xWbO262pX0XrBazeEV+RTI2x7wjGeQRrnhWt1jfnAXf6pj0/NOKyrHPLEYML2BF L9Ig== 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=3z6cuT+04YEJ35PlAKast9jdeih6eajuJ/oJXRUxgfI=; b=Lf474kjZiBfPcJBKD59WTE+3dVeoLwyJOfTWXiBhomly1M3+O6sITLcHtOEyZj2LZh gUCQuplu/sTOB1xVv8l/bGJFaYzAugV6+T59gyBvPxs4NInizYq8Ka3iu+65QPfJoiGL UtS0pHuMcu2jCcAwlXf5QR16laJu9oljyFoi5DA+J3dPuEagiec/iLDzUyGdEMgoTXn8 OoxNZLmH48ulc1i9VP+tq/ibK20QkbdR5jGmcAL0QESlq55cL4USAHRnWoOmnNlMhKvP U/TgcJG6CxdDHFtAF1XA7v9g5M/c+6fyEXJnrIf5SoLc0m5/XsmZHHksm3WkCDulxhIa vZmw== X-Gm-Message-State: ALKqPwdrkhGj1NiXNSwMkNwNGeFFbb2Ul5KAUpNafoN1etNIJDAr55rG P5JKI4vQQRrhG61d41SW67zIZk65 X-Google-Smtp-Source: AB8JxZq+94T/V6u96u/IWuqC4U5vzvq8wazUpE7ggrg5No+YY1HwGYmw2cH0860bmOggIZ478Ss/Jw== X-Received: by 2002:adf:85f4:: with SMTP id 49-v6mr3058725wru.33.1527273246141; Fri, 25 May 2018 11:34:06 -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 a8-v6sm11064392wrc.18.2018.05.25.11.34.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 25 May 2018 11:34:05 -0700 (PDT) From: Marek Vasut X-Google-Original-From: Marek Vasut To: linux-pci@vger.kernel.org Cc: Marek Vasut , Geert Uytterhoeven , Lorenzo Pieralisi , Phil Edworthy , Simon Horman , Wolfram Sang , linux-renesas-soc@vger.kernel.org Subject: [PATCH] PCI: rcar: Clean up PHY init on failure Date: Fri, 25 May 2018 20:33:26 +0200 Message-Id: <20180525183326.5245-1-marek.vasut+renesas@gmail.com> X-Mailer: git-send-email 2.16.2 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 the Gen3 PHY fails to power up, the code does not undo the initialization caused by phy_init(). Add the missing failure handling to the rcar_pcie_phy_init_gen3() function. Signed-off-by: Marek Vasut Reported-by: Geert Uytterhoeven Cc: Geert Uytterhoeven Cc: Lorenzo Pieralisi 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") Reviewed-by: Geert Uytterhoeven Acked-by: Simon Horman --- drivers/pci/host/pcie-rcar.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/pci/host/pcie-rcar.c b/drivers/pci/host/pcie-rcar.c index 695781934f0a..477bf40cc031 100644 --- a/drivers/pci/host/pcie-rcar.c +++ b/drivers/pci/host/pcie-rcar.c @@ -678,7 +678,11 @@ static int rcar_pcie_phy_init_gen3(struct rcar_pcie *pcie) if (err) return err; - return phy_power_on(pcie->phy); + err = phy_power_on(pcie->phy); + if (err) + phy_exit(pcie->phy); + + return err; } static int rcar_msi_alloc(struct rcar_msi *chip)