Received: by 2002:a89:d88:0:b0:1fa:5c73:8e2d with SMTP id eb8csp114043lqb; Thu, 23 May 2024 12:22:04 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUzxuf69gsEMIrz29ibXRZKteJT0zBD42cXVbm0uQsNzBkZ1Xd7G7vaBmbXezKjxQaPQ5Pir8jIFbjRtf0dTPingK+3Pr4RH1TeAD2pIw== X-Google-Smtp-Source: AGHT+IFf5YyyYfmDvyAp43J2mjVMqSYWEcULBE/gfxxzhYbhiQvtfAP0sPGRDm1aCtqMf7ImSa5p X-Received: by 2002:a17:902:e5cb:b0:1ec:3c71:eae7 with SMTP id d9443c01a7336-1f44902a744mr2690455ad.47.1716492124597; Thu, 23 May 2024 12:22:04 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716492124; cv=pass; d=google.com; s=arc-20160816; b=0FjD/+x+fCT6ljQ7xScJI1pAZ9xAFizdn8IRmP3tgYav8Sj/PPk8qEYeVRznxxLs4O E3uDR4fkyfBCnSTrZjIyvhJKjxegfOzHisEQi33T5XG6gZwz1cyvfWgBtwCQ74+DY5m/ 1MqlwAZXqQpEfDKhgcS8CT1RRwhR+tVQcygWcozb7zl5t38KUPx1xttXFR2/pkbTJFPu ARFb2lIgdII67meEyrQmV/B3sZm7SrJPooBQ7U9Vl9QhIciTIHSw5DLJW+SmkpsIr7RD OJML2MtrZCx0lEnvg1g013dWG0Tz53JubGn+kfFQmolI0SFV4FKv+5doc3zrmfPEcp75 W/0Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=WzX5A5SYPlpB7RwukIY2e9k3aUFWdFp/hlgqPag14Us=; fh=NCSKnKOg42/wkGFTwNfp9OciJZJqBmowbrke9ICC2nE=; b=wnbcRrNVOmo70XTilbATe2zBoNThYQTUlSJbVGlOb3qTh6lUmzcrY/m1LvZlFKug27 fUq0H7Blyv6gFXhDEzhgTMUJaMx/vMHvbhmIN0cH2wLp5kAUnYRgSuPRda1+RQReQLZi DvRR0wnmq/PkwVitMKQbp764bRphuonocBg0hvWwDveuPhi2gXwnXNWW9qcvh1hHQhcc aFuRvkrx8B0E9kIOSCHCNN7hekMkRH/ZRRA29We3m25X7H8P0w83PVZndjtGXNtII/WE fhEVpyclFxt8TtCfEztaesDq4lmA0/OEslbdFAhcvEinwMBvzSj2gb+2JhJQDVI9xRED wiZw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b="vnTX0/Cf"; 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-187924-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-187924-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 d9443c01a7336-1f350cc59b8si6510875ad.451.2024.05.23.12.22.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 May 2024 12:22:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-187924-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="vnTX0/Cf"; 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-187924-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-187924-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 2C172285B39 for ; Thu, 23 May 2024 19:22:04 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1C4D083A0E; Thu, 23 May 2024 19:21:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="vnTX0/Cf" Received: from out-170.mta1.migadu.com (out-170.mta1.migadu.com [95.215.58.170]) (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 0ADED839F3 for ; Thu, 23 May 2024 19:21:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.170 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716492117; cv=none; b=GZ0QPbmiqZ60nPEoa0sjUeLvDWm1H5euNMLOCv8V9CzfGCVA5ullMLJE6d1xT2wH36eAvzd/jaAgeXeKwbJxdX8NVcuoclCpjKfuVR3CiMXM1cU5gpA920Me6zzqAAfk463jc3Cm16icjYKFvRRgV03wY39UqvINdph4o7b+vYc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716492117; c=relaxed/simple; bh=25mrLq4UvC0JErHjDuS4X9W9wdyENwq5Smnn3Kaw0kE=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=h8azjPf5SswjpZzOuvwoklPSLnsP/ykFJK/ucDGvIh2hCrop8Eq3d88GzOf7nalB1MDU3fYdjvyBQs1aTg87b2MoVEdzRTftZhX/q9NspnQKF5ZdiIR2QeiNMCF/yE7HFXHOailpEdDwrWGYIoa3C20tqvGha2ceArbG/FkRaKw= 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=vnTX0/Cf; arc=none smtp.client-ip=95.215.58.170 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: markus.elfring@web.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1716492114; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=WzX5A5SYPlpB7RwukIY2e9k3aUFWdFp/hlgqPag14Us=; b=vnTX0/CfpQCPagjo016On7vSi/hVR85K2yQVOo+kUwULXO4l9MXFhPF7rSDbmtAbElptlb f9YWyZh55NSi7U6owtU3NemUwYbHwtxCDSXOoLgWfnKfrT0Rj9j/0UMFUlxTRQjrqWNOcs /jrUFZHR0K7vt0A+6BgLzR21uS39PpA= X-Envelope-To: linux-arm-kernel@lists.infradead.org X-Envelope-To: linux-pci@vger.kernel.org X-Envelope-To: kw@linux.com X-Envelope-To: lpieralisi@kernel.org X-Envelope-To: robh@kernel.org X-Envelope-To: linux-kernel@vger.kernel.org X-Envelope-To: bharat.kumar.gogada@xilinx.com X-Envelope-To: bhelgaas@google.com X-Envelope-To: lorenzo.pieralisi@arm.com X-Envelope-To: michal.simek@amd.com X-Envelope-To: michal.simek@xilinx.com X-Envelope-To: thippeswamy.havalige@amd.com Message-ID: Date: Thu, 23 May 2024 15:21:48 -0400 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Subject: Re: [PATCH v3 5/7] PCI: xilinx-nwl: Clean up clock on probe failure/removal To: Markus Elfring , linux-arm-kernel@lists.infradead.org, linux-pci@vger.kernel.org, =?UTF-8?Q?Krzysztof_Wilczy=C5=84ski?= , Lorenzo Pieralisi , Rob Herring Cc: LKML , Bharat Kumar Gogada , Bjorn Helgaas , Lorenzo Pieralisi , Michal Simek , Michal Simek , Thippeswamy Havalige References: <20240520145402.2526481-6-sean.anderson@linux.dev> <4a43cda4-dfa4-4156-b616-75e740f6fd64@web.de> Content-Language: en-US X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Sean Anderson In-Reply-To: <4a43cda4-dfa4-4156-b616-75e740f6fd64@web.de> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT On 5/23/24 15:18, Markus Elfring wrote: >> Make sure we turn off the clock on probe failure and device removal. > … >> +++ b/drivers/pci/controller/pcie-xilinx-nwl.c > … >> @@ -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); > > I suggest to use the label “disable_unprepare_clock” directly before this function call > (in the if branch) so that a duplicate check would be avoided after some error cases. Well if you want to avoid a check, we can just do err = pci_host_probe(bridge); if (!err) return 0; err_clk: ... --Sean