Received: by 2002:a05:6500:2018:b0:1fb:9675:f89d with SMTP id t24csp576735lqh; Fri, 31 May 2024 09:44:06 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVfQL4niYGSgxS2OEL2gyEpum8A5cC/RplLi56Q7Zh829TnmahRsLv1mdlhPUGfBh/Q3Me1fxxtaEI/L4AAzTcrS6w8VfisjZQb7Bpr5Q== X-Google-Smtp-Source: AGHT+IEDLCkThkuILuXoyzusCCMKswefk0u7CsGMN8YX5TTmUa4XZDaiI9vUmpCaXnj02oe//nUp X-Received: by 2002:a17:902:d4c3:b0:1f6:f27:5504 with SMTP id d9443c01a7336-1f637010523mr32399175ad.32.1717173845823; Fri, 31 May 2024 09:44:05 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717173845; cv=pass; d=google.com; s=arc-20160816; b=HzHkmaa7u0sTJkc47TyOKUBDuJdqiSY2DdY71Ubspb1gEzX0nx/NIOTbM4xgY+SCKp FxniahhBZiNQLeTWDr+vn3H+vESxxZZB+8grFXw+Pz2aDeApf530qcqGSAbmVPyJYiJy SZw7K4zNpNJb78hoWOrmcspLYhpA0bJY27jW2aGLRSWD6+ByCouCzj9Cnv8sOJoDec7J j3KpC/n0i+knyGBuR3tae1r1aj/OYlLepqY01bDMTN32h2ys/Atb0AJgY8ksLbaR1vFj kUVhe+16r2o6GzIlx8ABCpxyCFtluPDV0AqIf3Ye4PHs28I8eTWskC+3Kv3O8yOL9ftq RX5g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=I+69+SauXlRGr83vkRntKy+tG2GRCo2TNeZSKQRi5Ls=; fh=hybIFecMMqZNMmHpIWg3Z/PeJPxLQd0X2PGpWQzuVj4=; b=xhano3yXLXhfygXMV+xAJQ1969Mn1XoyzN8q/0BwT3sGqKTSaklsq8qe8LVky0u91v ZwMIc6Pz6B4ZHI9dv3IIX5bEdj5wXcRCcci8oEzup5Cmtj2UqWBdFE+dpz7fvqsb7QRe EzlNfWYq4a8Fuz4VoTouLv/8/N7yM0N04iMU5FgPm7G3qZhvlyH0ky4L+/PIf1z62MAB nXkCAjBExbHYPeUc3bpKIRnskZP5HCPT2izbNRRua8zd/rfbch3o6PqX99GpdOyka+Nj DQuDOKuE33qabH5DHBD3A19c9DrYuKU+dpG56V/huoePRqCNgH/WQYELKU6DcTvDaWZC O7Aw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=m6msWpFG; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-197125-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-197125-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id d9443c01a7336-1f63233d672si18711175ad.127.2024.05.31.09.44.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 31 May 2024 09:44:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-197125-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=m6msWpFG; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-197125-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-197125-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 65CEFB2AF8B for ; Fri, 31 May 2024 16:15:26 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 502FF17CA0D; Fri, 31 May 2024 16:14:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="m6msWpFG" Received: from out-175.mta0.migadu.com (out-175.mta0.migadu.com [91.218.175.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D68B215D5AA for ; Fri, 31 May 2024 16:14:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.175 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717172043; cv=none; b=Y5kH9Jr2WsDgHgipHscptBEuriwTNp9RIONF9Mfb+0hazMw3Z/rWmgSqw3t+u7/D+US53KJ7EvLqtuuVbMYV01pkfNP2zcdd24wy/YLJpRY7qzerJYGp5UWByjkDN/r9/H9XMl6TQcdsyJXy8e5qima210bZrOtmOHmYMFyNEg4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717172043; c=relaxed/simple; bh=Sv0kXO5U58sa8ekVvYxZwcS1u8+AOzbc+91VoW2BY08=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=qWqMfc31ZcYFKO1wvACSaeeqURdocBSnSScnWrtQxYbZhXm0lnZUQXUpwa9mVlgjLT5drPWDY2jOTcbhA0KezXxcNpc7dqV10+V/Oo21tlu59nJuv+uyZfedwKmwt9i9q4F6SpBPis5VzCmkSA40pBf3G+05JZ9rCUcYd8GxYJs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=m6msWpFG; arc=none smtp.client-ip=91.218.175.175 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev X-Envelope-To: lpieralisi@kernel.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1717172039; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=I+69+SauXlRGr83vkRntKy+tG2GRCo2TNeZSKQRi5Ls=; b=m6msWpFGkT0ZKL73//fG5tT1q77SGccs1qwOMNeHBsM2Lo6GiyTjmUxklipEv563PwqDmg 6aQrurBeO/FcbhMNypxa3TxV3FcY4jnwLZLsR5ifQYJ5o0K/eRRzPfrSuN6JsYPAuhpWmt alRyRkFBE27d2sQzZutpxT0TORlIcBI= X-Envelope-To: kw@linux.com X-Envelope-To: robh@kernel.org X-Envelope-To: linux-pci@vger.kernel.org X-Envelope-To: thippeswamy.havalige@amd.com X-Envelope-To: linux-arm-kernel@lists.infradead.org X-Envelope-To: markus.elfring@web.de X-Envelope-To: dan.carpenter@linaro.org X-Envelope-To: linux-kernel@vger.kernel.org X-Envelope-To: bhelgaas@google.com X-Envelope-To: michal.simek@amd.com X-Envelope-To: sean.anderson@linux.dev X-Envelope-To: bharat.kumar.gogada@xilinx.com X-Envelope-To: lorenzo.pieralisi@arm.com X-Envelope-To: michal.simek@xilinx.com X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Sean Anderson To: Lorenzo Pieralisi , =?UTF-8?q?Krzysztof=20Wilczy=C5=84ski?= , Rob Herring , linux-pci@vger.kernel.org Cc: Thippeswamy Havalige , linux-arm-kernel@lists.infradead.org, Markus Elfring , Dan Carpenter , linux-kernel@vger.kernel.org, Bjorn Helgaas , Michal Simek , Sean Anderson , Bharat Kumar Gogada , Lorenzo Pieralisi , Michal Simek Subject: [PATCH v4 5/7] PCI: xilinx-nwl: Clean up clock on probe failure/removal Date: Fri, 31 May 2024 12:13:35 -0400 Message-Id: <20240531161337.864994-6-sean.anderson@linux.dev> In-Reply-To: <20240531161337.864994-1-sean.anderson@linux.dev> References: <20240531161337.864994-1-sean.anderson@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT Make sure we turn off the clock on probe failure and device removal. Fixes: de0a01f52966 ("PCI: xilinx-nwl: Enable the clock through CCF") Signed-off-by: Sean Anderson --- Changes in v4: - Move if to after pci_host_probe drivers/pci/controller/pcie-xilinx-nwl.c | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/drivers/pci/controller/pcie-xilinx-nwl.c b/drivers/pci/controller/pcie-xilinx-nwl.c index c0a60cebdb2e..e85158dc4e6c 100644 --- a/drivers/pci/controller/pcie-xilinx-nwl.c +++ b/drivers/pci/controller/pcie-xilinx-nwl.c @@ -779,6 +779,7 @@ static int nwl_pcie_probe(struct platform_device *pdev) return -ENODEV; pcie = pci_host_bridge_priv(bridge); + platform_set_drvdata(pdev, pcie); pcie->dev = dev; @@ -801,13 +802,13 @@ static int nwl_pcie_probe(struct platform_device *pdev) err = nwl_pcie_bridge_init(pcie); if (err) { dev_err(dev, "HW Initialization failed\n"); - return err; + goto err_clk; } err = nwl_pcie_init_irq_domain(pcie); if (err) { dev_err(dev, "Failed creating IRQ Domain\n"); - return err; + goto err_clk; } bridge->sysdata = pcie; @@ -817,11 +818,24 @@ static int nwl_pcie_probe(struct platform_device *pdev) err = nwl_pcie_enable_msi(pcie); if (err < 0) { dev_err(dev, "failed to enable MSI support: %d\n", err); - return err; + goto err_clk; } } - return pci_host_probe(bridge); + err = pci_host_probe(bridge); + if (!err) + return 0; + +err_clk: + clk_disable_unprepare(pcie->clk); + return err; +} + +static void nwl_pcie_remove(struct platform_device *pdev) +{ + struct nwl_pcie *pcie = platform_get_drvdata(pdev); + + clk_disable_unprepare(pcie->clk); } static struct platform_driver nwl_pcie_driver = { @@ -831,5 +845,6 @@ static struct platform_driver nwl_pcie_driver = { .of_match_table = nwl_pcie_of_match, }, .probe = nwl_pcie_probe, + .remove_new = nwl_pcie_remove, }; builtin_platform_driver(nwl_pcie_driver); -- 2.35.1.1320.gc452695387.dirty