Received: by 2002:ab2:6816:0:b0:1f9:5764:f03e with SMTP id t22csp2504970lqo; Mon, 20 May 2024 07:55:50 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXkUffcQUjisu+mjHtqPGnqmyy2fPpRhE04rixDHvlrtVfEDAsqrHU3sRemhRlrNT3xV6QBbquU40PSrKMMg8fr8Fqg2bbb2hnJ/zYgtA== X-Google-Smtp-Source: AGHT+IF2yLmy8h4SNXaUnso7L+Kz2YwMVNai/dQFvAg67KXlG0xD3z9SyQjiX+Wyk3P0RyAfLLtU X-Received: by 2002:a17:902:f78e:b0:1f3:6a4:342e with SMTP id d9443c01a7336-1f306a434c3mr15882045ad.41.1716216949963; Mon, 20 May 2024 07:55:49 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716216949; cv=pass; d=google.com; s=arc-20160816; b=ow2mqMJ8GM1KAwI76o6iARHPT6yRgV7HwH3SjUlVNEGtmmDoJpjeDf3ZBKDbJKgmlf P3MlP1kzs0KnXUfCcOx3+PBq2oNQzpyIrgXILzF8eLRS7Jx4foRn3JW31AkwkJ3u1PD2 QmRewzd4uyykfPEGwI9KBPYb7XoSkDp/ssYAu345Inl4JnU/s+cG8kfjM2FvoWxvsmD8 nETPWrtaCtRjKdydmrK8z+i9qlGC6ije4UCg8Nb1hGWOz7VPH4MILKCM/yzs7o76CpeQ LH5eLAdAce3AWzSGfvTmTq/E2fvEWRlmBomzigLP3WRV1YRlj6vxUaQDX6icmmhmDAHX BBrg== 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=vtlPUzut99fgqzwIOlVSGdtokjNewldmjFQ9baMdh6A=; fh=sNVBpbHWhpshX/uSe7PTFhxqm/8WKlVxYiQrE2heXZ8=; b=lK9uyymnHudc6Yecw0G5jWo86ya/0Cgzy6K1TsXAT5JrhYCdnqJWyI9LdX+KUaov27 E7Uy3VctlXVcxN0+okqGC7pqW4E13cRi1IX8RT/YNwzspO1smbChWmbfF5LEOS2rDt8N W+61XBgk2uUb73wOPYbXl4RJlNLeTVxpInjdUYt4/ysgDMHIaMCzjmiE5OJYTYrdcQLf PPGsLbVg67ungfMmOAhdYFTEUpUfkFtvXD4pIWk4aWj7ClsIs2ljz7UywHD9XN8QBqY8 4SFI0VCqj/MWp6Zvj1eFL1xdUC2StonSd1rdfbBcJEUH6Z28zbFa5HpBxVIZAsIRuRxU 0K8g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=ek3vP4gN; 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-183865-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-183865-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id d9443c01a7336-1f0932c1539si106934065ad.134.2024.05.20.07.55.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 May 2024 07:55:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-183865-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=ek3vP4gN; 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-183865-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-183865-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 0745D28129E for ; Mon, 20 May 2024 14:55:43 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 81726137C26; Mon, 20 May 2024 14:54:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="ek3vP4gN" Received: from out-173.mta0.migadu.com (out-173.mta0.migadu.com [91.218.175.173]) (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 24F571369B4 for ; Mon, 20 May 2024 14:54:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.173 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716216865; cv=none; b=IhT6hrXjoMXj0i36Iseb0Su38xhCDsqSby4widOPeF+6TO4OcpV77kv8HCCp1buPRh8kuAJui8w2ObwM0tJqKCcK3f9bH6QcT6F+0a4+9O0DtJ2Z6GgRT63HgZtuzfGwnEXDVRb/wLWoRRYE4+x3JnQVe3XFEwssX7XlBmO9tkY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716216865; c=relaxed/simple; bh=zUjxErAfNxsRNkAthkqFDhI6NogrjhKQNib6awNIKNc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Z4ogTlfvxGGQ5WLFlUeXvY92tQ7pfZ1mdJZseti9JRFGazdthLxxxrXzmqlYU1F5+B1jpHVP3eFQ3szSXTzfR5IRQEmI935labMBg5d7etyQGqzFWB5a1dJVvdR/RqFBJXd2E/qYkTl4Wqu2chCIlNn5NpCfVtOT86wYN2sliHg= 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=ek3vP4gN; arc=none smtp.client-ip=91.218.175.173 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=1716216862; 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=vtlPUzut99fgqzwIOlVSGdtokjNewldmjFQ9baMdh6A=; b=ek3vP4gN5H0U9AvSl18KYnpeAnAhzV6VPfmhrOugJy1fV+xFv+hpbiyKC99AHBRDgv7p4I pEC69vnzUa3/e3QtLE5Cse+JN/fHgkZDgsLfoyYcNDSJDXuzzY3un/CuYeK8Aav3G7Yi12 zX7oURMTnmalD6li5HQ9snlyNUHD2DQ= X-Envelope-To: kw@linux.com X-Envelope-To: robh@kernel.org X-Envelope-To: linux-pci@vger.kernel.org X-Envelope-To: michal.simek@amd.com X-Envelope-To: thippeswamy.havalige@amd.com X-Envelope-To: linux-arm-kernel@lists.infradead.org X-Envelope-To: bhelgaas@google.com X-Envelope-To: linux-kernel@vger.kernel.org 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: Michal Simek , Thippeswamy Havalige , linux-arm-kernel@lists.infradead.org, Bjorn Helgaas , linux-kernel@vger.kernel.org, Sean Anderson , Bharat Kumar Gogada , Lorenzo Pieralisi , Michal Simek Subject: [PATCH v3 5/7] PCI: xilinx-nwl: Clean up clock on probe failure/removal Date: Mon, 20 May 2024 10:54:00 -0400 Message-Id: <20240520145402.2526481-6-sean.anderson@linux.dev> In-Reply-To: <20240520145402.2526481-1-sean.anderson@linux.dev> References: <20240520145402.2526481-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 --- (no changes since v1) drivers/pci/controller/pcie-xilinx-nwl.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/drivers/pci/controller/pcie-xilinx-nwl.c b/drivers/pci/controller/pcie-xilinx-nwl.c index c0a60cebdb2e..424cc5a1b4d1 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,23 @@ 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); + +err_clk: + if (err) + 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 +844,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