All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sean Anderson <sean.anderson@linux.dev>
To: "Markus Elfring" <Markus.Elfring@web.de>,
	linux-arm-kernel@lists.infradead.org, linux-pci@vger.kernel.org,
	"Krzysztof Wilczyński" <kw@linux.com>,
	"Lorenzo Pieralisi" <lpieralisi@kernel.org>,
	"Rob Herring" <robh@kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Bharat Kumar Gogada <bharat.kumar.gogada@xilinx.com>,
	Bjorn Helgaas <bhelgaas@google.com>,
	Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>,
	Michal Simek <michal.simek@amd.com>,
	Michal Simek <michal.simek@xilinx.com>,
	Thippeswamy Havalige <thippeswamy.havalige@amd.com>
Subject: Re: [PATCH v3 5/7] PCI: xilinx-nwl: Clean up clock on probe failure/removal
Date: Thu, 23 May 2024 15:21:48 -0400	[thread overview]
Message-ID: <bb9e239f-902b-4f52-a5e9-98c29b360418@linux.dev> (raw)
In-Reply-To: <4a43cda4-dfa4-4156-b616-75e740f6fd64@web.de>

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

WARNING: multiple messages have this Message-ID (diff)
From: Sean Anderson <sean.anderson@linux.dev>
To: "Markus Elfring" <Markus.Elfring@web.de>,
	linux-arm-kernel@lists.infradead.org, linux-pci@vger.kernel.org,
	"Krzysztof Wilczyński" <kw@linux.com>,
	"Lorenzo Pieralisi" <lpieralisi@kernel.org>,
	"Rob Herring" <robh@kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Bharat Kumar Gogada <bharat.kumar.gogada@xilinx.com>,
	Bjorn Helgaas <bhelgaas@google.com>,
	Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>,
	Michal Simek <michal.simek@amd.com>,
	Michal Simek <michal.simek@xilinx.com>,
	Thippeswamy Havalige <thippeswamy.havalige@amd.com>
Subject: Re: [PATCH v3 5/7] PCI: xilinx-nwl: Clean up clock on probe failure/removal
Date: Thu, 23 May 2024 15:21:48 -0400	[thread overview]
Message-ID: <bb9e239f-902b-4f52-a5e9-98c29b360418@linux.dev> (raw)
In-Reply-To: <4a43cda4-dfa4-4156-b616-75e740f6fd64@web.de>

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

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2024-05-23 19:21 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-20 14:53 [PATCH v3 0/7] PCI: xilinx-nwl: Add phy support Sean Anderson
2024-05-20 14:53 ` Sean Anderson
2024-05-20 14:53 ` [PATCH v3 1/7] dt-bindings: pci: xilinx-nwl: Add phys Sean Anderson
2024-05-20 14:53   ` Sean Anderson
2024-05-22 14:46   ` Rob Herring (Arm)
2024-05-22 14:46     ` Rob Herring (Arm)
2024-05-22 22:28   ` Bjorn Helgaas
2024-05-22 22:28     ` Bjorn Helgaas
2024-05-23 15:19     ` Sean Anderson
2024-05-23 15:19       ` Sean Anderson
2024-05-20 14:53 ` [PATCH v3 2/7] PCI: xilinx-nwl: Fix off-by-one in IRQ handler Sean Anderson
2024-05-20 14:53   ` Sean Anderson
2024-05-22 22:28   ` Bjorn Helgaas
2024-05-22 22:28     ` Bjorn Helgaas
2024-05-23 15:21     ` Sean Anderson
2024-05-23 15:21       ` Sean Anderson
2024-05-24 14:56       ` Dan Carpenter
2024-05-24 14:56         ` Dan Carpenter
2024-05-24 15:03         ` Sean Anderson
2024-05-24 15:03           ` Sean Anderson
2024-05-20 14:53 ` [PATCH v3 3/7] PCI: xilinx-nwl: Fix register misspelling Sean Anderson
2024-05-20 14:53   ` Sean Anderson
2024-05-20 14:53 ` [PATCH v3 4/7] PCI: xilinx-nwl: Rate-limit misc interrupt messages Sean Anderson
2024-05-20 14:53   ` Sean Anderson
2024-05-20 14:54 ` [PATCH v3 5/7] PCI: xilinx-nwl: Clean up clock on probe failure/removal Sean Anderson
2024-05-20 14:54   ` Sean Anderson
2024-05-23 19:18   ` Markus Elfring
2024-05-23 19:18     ` Markus Elfring
2024-05-23 19:21     ` Sean Anderson [this message]
2024-05-23 19:21       ` Sean Anderson
2024-05-23 20:11       ` Markus Elfring
2024-05-23 20:11         ` Markus Elfring
2024-05-23 20:18         ` Sean Anderson
2024-05-23 20:18           ` Sean Anderson
2024-05-20 14:54 ` [PATCH v3 6/7] PCI: xilinx-nwl: Add phy support Sean Anderson
2024-05-20 14:54   ` Sean Anderson
2024-05-24  8:16   ` Markus Elfring
2024-05-24  8:16     ` Markus Elfring
2024-05-24 14:38     ` Sean Anderson
2024-05-24 14:38       ` Sean Anderson
2024-05-24 15:35       ` Markus Elfring
2024-05-24 15:35         ` Markus Elfring
2024-05-24 14:59   ` Dan Carpenter
2024-05-24 14:59     ` Dan Carpenter
2024-05-24 15:24     ` Sean Anderson
2024-05-24 15:24       ` Sean Anderson
2024-05-20 14:54 ` [PATCH v3 7/7] arm64: zynqmp: Add PCIe phys Sean Anderson
2024-05-20 14:54   ` Sean Anderson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bb9e239f-902b-4f52-a5e9-98c29b360418@linux.dev \
    --to=sean.anderson@linux.dev \
    --cc=Markus.Elfring@web.de \
    --cc=bharat.kumar.gogada@xilinx.com \
    --cc=bhelgaas@google.com \
    --cc=kw@linux.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=lorenzo.pieralisi@arm.com \
    --cc=lpieralisi@kernel.org \
    --cc=michal.simek@amd.com \
    --cc=michal.simek@xilinx.com \
    --cc=robh@kernel.org \
    --cc=thippeswamy.havalige@amd.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.