public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <jonathan.cameron@huawei.com>
To: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
Cc: "Thomas Petazzoni" <thomas.petazzoni@bootlin.com>,
	"Pali Rohár" <pali@kernel.org>,
	"Lorenzo Pieralisi" <lpieralisi@kernel.org>,
	"Krzysztof Wilczyński" <kwilczynski@kernel.org>,
	"Manivannan Sadhasivam" <mani@kernel.org>,
	"Rob Herring" <robh@kernel.org>,
	"Bjorn Helgaas" <bhelgaas@google.com>,
	"Madhavan Srinivasan" <maddy@linux.ibm.com>,
	"Michael Ellerman" <mpe@ellerman.id.au>,
	"Nicholas Piggin" <npiggin@gmail.com>,
	"Christophe Leroy (CS GROUP)" <chleroy@kernel.org>,
	"Tyrel Datwyler" <tyreld@linux.ibm.com>,
	linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH 1/3] PCI: mvebu: Simplify with scoped for each OF child loop
Date: Mon, 5 Jan 2026 10:35:02 +0000	[thread overview]
Message-ID: <20260105103502.00002efe@huawei.com> (raw)
In-Reply-To: <20260102124900.64528-4-krzysztof.kozlowski@oss.qualcomm.com>

On Fri,  2 Jan 2026 13:49:01 +0100
Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com> wrote:

> Use scoped for-each loop when iterating over device nodes to make code a
> bit simpler.
> 
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
Hi Krzysztof,

Drive by review.  Your changes are functionally equivalent and lgtm.
However, I am curious at whether the lack of reference count for child
when stashed in port->dn (and then used in the for loop) is a potential
issue.

Jonathan

> ---
>  drivers/pci/controller/pci-mvebu.c | 10 ++++------
>  1 file changed, 4 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/pci/controller/pci-mvebu.c b/drivers/pci/controller/pci-mvebu.c
> index a72aa57591c0..4d3c97b62fe0 100644
> --- a/drivers/pci/controller/pci-mvebu.c
> +++ b/drivers/pci/controller/pci-mvebu.c
> @@ -1452,7 +1452,6 @@ static int mvebu_pcie_probe(struct platform_device *pdev)
>  	struct mvebu_pcie *pcie;
>  	struct pci_host_bridge *bridge;
>  	struct device_node *np = dev->of_node;
> -	struct device_node *child;
>  	int num, i, ret;
>  
>  	bridge = devm_pci_alloc_host_bridge(dev, sizeof(struct mvebu_pcie));
> @@ -1474,16 +1473,14 @@ static int mvebu_pcie_probe(struct platform_device *pdev)
>  		return -ENOMEM;
>  
>  	i = 0;
> -	for_each_available_child_of_node(np, child) {
> +	for_each_available_child_of_node_scoped(np, child) {
>  		struct mvebu_pcie_port *port = &pcie->ports[i];
>  
>  		ret = mvebu_pcie_parse_port(pcie, port, child);
> -		if (ret < 0) {
> -			of_node_put(child);
> +		if (ret < 0)
>  			return ret;
> -		} else if (ret == 0) {
> +		else if (ret == 0)
>  			continue;
> -		}
>  
>  		port->dn = child;
>  		i++;
> @@ -1493,6 +1490,7 @@ static int mvebu_pcie_probe(struct platform_device *pdev)
>  	for (i = 0; i < pcie->nports; i++) {
>  		struct mvebu_pcie_port *port = &pcie->ports[i];
>  		int irq = port->intx_irq;
> +		struct device_node *child;
>  
>  		child = port->dn;
>  		if (!child)


  parent reply	other threads:[~2026-01-05 10:35 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-02 12:49 [PATCH 1/3] PCI: mvebu: Simplify with scoped for each OF child loop Krzysztof Kozlowski
2026-01-02 12:49 ` [PATCH 2/3] PCI: pnv_php: " Krzysztof Kozlowski
2026-01-05 10:36   ` Jonathan Cameron
2026-01-02 12:49 ` [PATCH 3/3] PCI: rpaphp: " Krzysztof Kozlowski
2026-01-05 10:37   ` Jonathan Cameron
2026-01-05 10:35 ` Jonathan Cameron [this message]
2026-02-16 15:15   ` [PATCH 1/3] PCI: mvebu: " Manivannan Sadhasivam

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=20260105103502.00002efe@huawei.com \
    --to=jonathan.cameron@huawei.com \
    --cc=bhelgaas@google.com \
    --cc=chleroy@kernel.org \
    --cc=krzysztof.kozlowski@oss.qualcomm.com \
    --cc=kwilczynski@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=lpieralisi@kernel.org \
    --cc=maddy@linux.ibm.com \
    --cc=mani@kernel.org \
    --cc=mpe@ellerman.id.au \
    --cc=npiggin@gmail.com \
    --cc=pali@kernel.org \
    --cc=robh@kernel.org \
    --cc=thomas.petazzoni@bootlin.com \
    --cc=tyreld@linux.ibm.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox