public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Gregory CLEMENT <gregory.clement@bootlin.com>
To: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>,
	Andrew Lunn <andrew@lunn.ch>,
	Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Cc: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
Subject: Re: [PATCH] soc: dove: pmu: Simplify with scoped for each OF child loop
Date: Mon, 05 Jan 2026 15:04:11 +0100	[thread overview]
Message-ID: <87ms2sqhpg.fsf@BLaptop.bootlin.com> (raw)
In-Reply-To: <20260102124801.64172-2-krzysztof.kozlowski@oss.qualcomm.com>

Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com> writes:

> 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>

Applied on mvebu/arm

Thanks,

Gregory
> ---
>  drivers/soc/dove/pmu.c | 9 +++------
>  1 file changed, 3 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/soc/dove/pmu.c b/drivers/soc/dove/pmu.c
> index 7bbd3f940e4d..dd8ade8e9ee8 100644
> --- a/drivers/soc/dove/pmu.c
> +++ b/drivers/soc/dove/pmu.c
> @@ -371,7 +371,7 @@ int __init dove_init_pmu_legacy(const struct dove_pmu_initdata *initdata)
>   */
>  int __init dove_init_pmu(void)
>  {
> -	struct device_node *np_pmu, *domains_node, *np;
> +	struct device_node *np_pmu, *domains_node;
>  	struct pmu_data *pmu;
>  	int ret, parent_irq;
>  
> @@ -404,21 +404,18 @@ int __init dove_init_pmu(void)
>  
>  	pmu_reset_init(pmu);
>  
> -	for_each_available_child_of_node(domains_node, np) {
> +	for_each_available_child_of_node_scoped(domains_node, np) {
>  		struct of_phandle_args args;
>  		struct pmu_domain *domain;
>  
>  		domain = kzalloc(sizeof(*domain), GFP_KERNEL);
> -		if (!domain) {
> -			of_node_put(np);
> +		if (!domain)
>  			break;
> -		}
>  
>  		domain->pmu = pmu;
>  		domain->base.name = kasprintf(GFP_KERNEL, "%pOFn", np);
>  		if (!domain->base.name) {
>  			kfree(domain);
> -			of_node_put(np);
>  			break;
>  		}
>  
> -- 
> 2.51.0
>

-- 
Grégory CLEMENT, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

      reply	other threads:[~2026-01-05 14:04 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-02 12:48 [PATCH] soc: dove: pmu: Simplify with scoped for each OF child loop Krzysztof Kozlowski
2026-01-05 14:04 ` Gregory CLEMENT [this message]

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=87ms2sqhpg.fsf@BLaptop.bootlin.com \
    --to=gregory.clement@bootlin.com \
    --cc=andrew@lunn.ch \
    --cc=krzysztof.kozlowski@oss.qualcomm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sebastian.hesselbarth@gmail.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