From patchwork Mon Oct 30 08:21:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 159555 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:d641:0:b0:403:3b70:6f57 with SMTP id cy1csp2055074vqb; Mon, 30 Oct 2023 01:21:59 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF66v+vq8BD4snd1x9W39fEPaA0LbDOwPPJiHWEOpTNfl5kYvnWomxaCmGfdkLQ1lwc+Ksj X-Received: by 2002:a17:902:7fcf:b0:1cc:1efb:1bab with SMTP id t15-20020a1709027fcf00b001cc1efb1babmr5710083plb.38.1698654119361; Mon, 30 Oct 2023 01:21:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698654119; cv=none; d=google.com; s=arc-20160816; b=cBzLl8tDFIspuV227JKHE+35IqzCgESt4YqfEzajoHRLQS3DlNZ8D2BsRZMFzy/tgl l0juVHeDfvtnA+Va3dhNLXGvSvJNihj/Io5eX2IA7CNaZLXApw+zVuDJq3JpmLsGbEIg et10epxosau4hoLaIl5W0O1VwTlCCrlE28642exFWPxbLk/p26i5RHi49YJn0nVS4olK fLpsR7OIk6QILIgh/q1Iooddw1Sn/OpS9WiYwrDPNx+t7XVMzpfnpOkeO9Tt51C6A4Fh u3jcT/lzmQLTP9P2NNEdjFzoIndMVA06u6bQbDF0Zl5TtViVmDWQAPmzQWqRsVUy4WRf o3rw== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=3VXcFUM59+a6yTHwvN11t3YSHRRSpkC7ssA2S+DiK0A=; fh=+P/RXkrEsz+aau1A+coJFqwXvz0rvLPAPQ8TEg7cdCM=; b=Jd7AegXbGFoENplHRsI4dp3tUp5aORePNvDE/iRxEYC03fzNhKwL6RUiX2GA/Lynf7 yvt+tpEkQdzEUFC9Hy/HN2lcSYhlKpZ/6sbEDdxzsge5k4kBFkKKYDA0rOW3yS/GbYFv brWgVKSw8QuWo94rubVXC1BtqxYN6VSDK46Hap72ZwACJKTC1kqtcSH8kC85q7bw/28d 7Ct9cMOqm6w1UJ13jMfnLjFSRm2l1EnPV6325uljYuU1mlB0rgYLAs6RcpHtTRNWeOFL fzTv2f5UYEtk4VbvTCzM8FyCl7rIOeJ2oXpREMRhMurTGZiRGv3ZzRUD8t6w4cjtvoM/ kDVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=ciL54POF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=wanadoo.fr Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id kk3-20020a170903070300b001cc467a339esi1537859plb.389.2023.10.30.01.21.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Oct 2023 01:21:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=ciL54POF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=wanadoo.fr Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 56F8E8065018; Mon, 30 Oct 2023 01:21:34 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231467AbjJ3IV1 (ORCPT + 31 others); Mon, 30 Oct 2023 04:21:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36230 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232022AbjJ3IV0 (ORCPT ); Mon, 30 Oct 2023 04:21:26 -0400 Received: from smtp.smtpout.orange.fr (smtp-19.smtpout.orange.fr [80.12.242.19]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 34CD5AB for ; Mon, 30 Oct 2023 01:21:24 -0700 (PDT) Received: from pop-os.home ([86.243.2.178]) by smtp.orange.fr with ESMTPA id xNWPqRZ1MjwlwxNWPqO2Tz; Mon, 30 Oct 2023 09:21:22 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1698654082; bh=3VXcFUM59+a6yTHwvN11t3YSHRRSpkC7ssA2S+DiK0A=; h=From:To:Cc:Subject:Date; b=ciL54POF1xrD14QUPwx63HiBkJ+cEP0l2VpgVDg3lFrzxGHyfqFCb0gB2cWTngbYn adEOjMR4CO+GetQgS2K7cEDJ5z6owMmJQfCiVW7UPEXE3kmCR66jnscVIhNmyXE7W1 afgzgw4TZIYIsUbEAl2qSZAleAvmcyYcj/dbEX7nLaOcp/pmpQnby+UIoE8IAg2Rwa KqqVYhRcN27pRTluiVb5OLQ9yxw52kvvKtXwk+rsTJlEg0Jvyjy4z7m2tIZtv2CFbQ vo9CHWbhgQMT6GbDk7llatDHmUE38ivu79aqtkdjDff+648jJLi69Gvcg53Ts6IXD1 R+H0U1u1U9LsQ== X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Mon, 30 Oct 2023 09:21:22 +0100 X-ME-IP: 86.243.2.178 From: Christophe JAILLET To: Xiaowei Song , Binghui Wang , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84?= =?utf-8?q?ski?= , Rob Herring , Bjorn Helgaas , Jingoo Han Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET , linux-pci@vger.kernel.org Subject: [PATCH] PCI: kirin: Fix an error path in kirin_pcie_probe() Date: Mon, 30 Oct 2023 09:21:16 +0100 Message-Id: X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Mon, 30 Oct 2023 01:21:34 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1781167941528537093 X-GMAIL-MSGID: 1781167941528537093 If an error occurs after a successful kirin_pcie_power_on(), kirin_pcie_power_off() should be called, as already done in the remove function. Fixes: fc5165db245a ("PCI: kirin: Add HiSilicon Kirin SoC PCIe controller driver") Signed-off-by: Christophe JAILLET Reviewed-by: Serge Semin --- Not sure of the Fixes tag. --- drivers/pci/controller/dwc/pcie-kirin.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/pci/controller/dwc/pcie-kirin.c b/drivers/pci/controller/dwc/pcie-kirin.c index 2ee146767971..0b93de9d2d06 100644 --- a/drivers/pci/controller/dwc/pcie-kirin.c +++ b/drivers/pci/controller/dwc/pcie-kirin.c @@ -813,7 +813,15 @@ static int kirin_pcie_probe(struct platform_device *pdev) if (ret) return ret; - return dw_pcie_host_init(&pci->pp); + ret = dw_pcie_host_init(&pci->pp); + if (ret) + goto err_power_off; + + return 0; + +err_power_off: + kirin_pcie_power_off(kirin_pcie); + return ret; } static struct platform_driver kirin_pcie_driver = {