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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20260105103611.0000788f@huawei.com>
Date: Mon, 5 Jan 2026 10:36:11 +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 2/3] PCI: pnv_php: Simplify with scoped for each OF
 child loop

On Fri,  2 Jan 2026 13:49:02 +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>
Reviewed-by: Jonathan Cameron <jonathan.cameron@...wei.com>

> ---
>  drivers/pci/hotplug/pnv_php.c | 19 +++++++------------
>  1 file changed, 7 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/pci/hotplug/pnv_php.c b/drivers/pci/hotplug/pnv_php.c
> index c5345bff9a55..0d80bee284e0 100644
> --- a/drivers/pci/hotplug/pnv_php.c
> +++ b/drivers/pci/hotplug/pnv_php.c
> @@ -215,24 +215,19 @@ static void pnv_php_reverse_nodes(struct device_node *parent)
>  static int pnv_php_populate_changeset(struct of_changeset *ocs,
>  				      struct device_node *dn)
>  {
> -	struct device_node *child;
> -	int ret = 0;
> +	int ret;
>  
> -	for_each_child_of_node(dn, child) {
> +	for_each_child_of_node_scoped(dn, child) {
>  		ret = of_changeset_attach_node(ocs, child);
> -		if (ret) {
> -			of_node_put(child);
> -			break;
> -		}
> +		if (ret)
> +			return ret;
>  
>  		ret = pnv_php_populate_changeset(ocs, child);
> -		if (ret) {
> -			of_node_put(child);
> -			break;
> -		}
> +		if (ret)
> +			return ret;
>  	}
>  
> -	return ret;
> +	return 0;
>  }
>  
>  static void *pnv_php_add_one_pdn(struct device_node *dn, void *data)


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ