lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20260105103502.00002efe@huawei.com>
Date: Mon, 5 Jan 2026 10:35:02 +0000
From: Jonathan Cameron <jonathan.cameron@...wei.com>
To: Krzysztof Kozlowski <krzysztof.kozlowski@....qualcomm.com>
CC: Thomas Petazzoni <thomas.petazzoni@...tlin.com>, Pali Rohár <pali@...nel.org>, Lorenzo Pieralisi
	<lpieralisi@...nel.org>, Krzysztof Wilczyński
	<kwilczynski@...nel.org>, Manivannan Sadhasivam <mani@...nel.org>, "Rob
 Herring" <robh@...nel.org>, Bjorn Helgaas <bhelgaas@...gle.com>, "Madhavan
 Srinivasan" <maddy@...ux.ibm.com>, Michael Ellerman <mpe@...erman.id.au>,
	Nicholas Piggin <npiggin@...il.com>, "Christophe Leroy (CS GROUP)"
	<chleroy@...nel.org>, Tyrel Datwyler <tyreld@...ux.ibm.com>,
	<linux-pci@...r.kernel.org>, <linux-arm-kernel@...ts.infradead.org>,
	<linux-kernel@...r.kernel.org>, <linuxppc-dev@...ts.ozlabs.org>
Subject: Re: [PATCH 1/3] PCI: mvebu: Simplify with scoped for each OF child
 loop

On Fri,  2 Jan 2026 13:49:01 +0100
Krzysztof Kozlowski <krzysztof.kozlowski@....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@....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)


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ