Received: by 2002:ab2:7b86:0:b0:1f7:5705:b850 with SMTP id q6csp1497082lqh; Mon, 6 May 2024 09:17:53 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVhb1z70SXO1mUd2MLqZ6GoQ/LZ9ZeZF86bAzHQBs8mzgd+wsBT+fR5SF/vy+4+EoGHY8lKe2Lxa/1TE6mKmGf/thz2vw+SCSX4wabF9A== X-Google-Smtp-Source: AGHT+IGUOJFZYSOz7fC5EDjmzNTIKZcznCIP/wR6rPPGJ4dUw2JkvvfzYbx6CXg8JALiKrNYAHis X-Received: by 2002:a17:90a:6fc4:b0:2ae:72a3:2ed4 with SMTP id e62-20020a17090a6fc400b002ae72a32ed4mr9788389pjk.15.1715012273476; Mon, 06 May 2024 09:17:53 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715012273; cv=pass; d=google.com; s=arc-20160816; b=cV7MQzs/PR/hLF0wv92QGpCgzl6AeDHttPM6bTRhleHH0v6msi6owc9l33SHGvm6zs lpmUmhbiNXdyUmLtRk9AtJkSyYUJduWVdxF8Sz4cVf583DlQ6GPTg2YbaXCvA7JfnkxV t44XNWqjVeEC5h5dx/doRejV4PolGR3tfHWHMjcjmLf38go0vSNTxhWDBRX0TLTtdp/+ oYBMD4uYi9LDvKZrJzGU24SXITLdUBON1jffl7J3R91EpW+LUvpOFZ0mhMXYucrS+s74 z+pyjaMKwF5dP5pEEyIg17dnz2xeVQ0IGSlygBA2Ax4iAvMHBARBoVQ4dQ1Ltdc5HyNZ sfLA== 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=jyh5f6YsGaQ7Gmi9K6WZw1loVoeMR+7Gug7kZL4pKH0=; b=iZvuC3wC2WtpwnLgmerLs4gpdze84qF+QgQ8j0g5AkAO7GGQlE3/ETE1Rucb4hquJ/ b1DvCSP6wv/wyAhlE6VkXZ6RPqEcnqkGiASz2s5BWluor7HW3V1rzd8807kBCSUBNcTp t/kygCvJEk3iI2oDqSgu65Hjc1oXnDH3Fa2qBNP8Dkb4ZHxToV3lJiZWscPG/i6/Hp+g pBmBQFEWd82gk0cQmoTpduIZhQO0jUE/6Jvh4ZRZp45ZKzTF6IAGfR9NYX00WLk1DEKZ JETaJp2tC4u5QULqwvddRPQqqOR9utd8YiDI5I3Bx5eRO+tfgKZnOKQmhS21pKcBzBi5 VE2w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=beKg6+up; 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-170139-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-170139-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. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id ne16-20020a17090b375000b002b154a15616si8562978pjb.53.2024.05.06.09.17.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 May 2024 09:17:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-170139-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=beKg6+up; 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-170139-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-170139-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 87205285D6A for ; Mon, 6 May 2024 16:17:12 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6C7E4157498; Mon, 6 May 2024 16:15:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="beKg6+up" Received: from out-189.mta0.migadu.com (out-189.mta0.migadu.com [91.218.175.189]) (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 0DBA415746E for ; Mon, 6 May 2024 16:15:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.189 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715012139; cv=none; b=iZgfB+5BISVmEF01yNCTtyqOrdtPWj96yqoqwHqQ9FBkrzbdlC87p/SDUb8hzVDgWaQTckjyd+1712jSAtObBiqappeAyhVKHshVw1kW+1xBeXgntm5kTzgMl/dxylFhPLgraaQ7cx2ujUhI+G92dIeHkCfhkjg1wG60FzwwLG0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715012139; c=relaxed/simple; bh=zUjxErAfNxsRNkAthkqFDhI6NogrjhKQNib6awNIKNc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Dj66hCtnFzm+ub4ys3xJfJ+62l3jF70Ymc9qfFdPv9cIGEBL2WkKqRZef6QUZSMhKzJsB0oFt8zsj4P3fXlU3/XhjMdzC9ggHCaP2Fz5HlDHAtXCEX3lRRIOUBc9n9Hps9ZB5XtYxIeOlfI4LUlNMuvLh9INVA7VGsA0lZWKhtA= 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=beKg6+up; arc=none smtp.client-ip=91.218.175.189 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-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1715012136; 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=beKg6+up+zeyc8oCa+O2DfND2aDcOLe9OAGt/ipw2zvOqryyv9MZuXQ1PWKJEshAbUcNQk 9mz4D8Rl9/1ZBN38EBGquhMW0CZ9uI579Lcj1QEc1QGjp9bNJMgigGh3ZUUZTIVugu0ivX fQI57+BYBLoTFKdl82MjJYMmUk8lKkY= From: Sean Anderson To: Lorenzo Pieralisi , =?UTF-8?q?Krzysztof=20Wilczy=C5=84ski?= , Rob Herring , linux-pci@vger.kernel.org Cc: Michal Simek , Bjorn Helgaas , Thippeswamy Havalige , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Sean Anderson , Bharat Kumar Gogada , Lorenzo Pieralisi , Michal Simek Subject: [PATCH v2 5/7] PCI: xilinx-nwl: Clean up clock on probe failure/removal Date: Mon, 6 May 2024 12:15:08 -0400 Message-Id: <20240506161510.2841755-6-sean.anderson@linux.dev> In-Reply-To: <20240506161510.2841755-1-sean.anderson@linux.dev> References: <20240506161510.2841755-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