All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gregory CLEMENT <gregory.clement@bootlin.com>
To: Julia Lawall <Julia.Lawall@inria.fr>, Andrew Lunn <andrew@lunn.ch>
Cc: kernel-janitors@vger.kernel.org,
	Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 07/11] soc: dove: add missing of_node_put
Date: Wed, 20 Sep 2023 11:30:30 +0200	[thread overview]
Message-ID: <87jzslfayx.fsf@BL-laptop> (raw)
In-Reply-To: <20230907095521.14053-8-Julia.Lawall@inria.fr>

Julia Lawall <Julia.Lawall@inria.fr> writes:

> for_each_available_child_of_node performs an of_node_get
> on each iteration, so a break out of the loop requires an
> of_node_put.
>
> This was done using the Coccinelle semantic patch
> iterators/for_each_child.cocci
>
> Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>

Applied on mvebu/arm

Thanks,

Gregory
>
> ---
>  drivers/soc/dove/pmu.c |    5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff -u -p a/drivers/soc/dove/pmu.c b/drivers/soc/dove/pmu.c
> --- a/drivers/soc/dove/pmu.c
> +++ b/drivers/soc/dove/pmu.c
> @@ -410,13 +410,16 @@ int __init dove_init_pmu(void)
>  		struct pmu_domain *domain;
>  
>  		domain = kzalloc(sizeof(*domain), GFP_KERNEL);
> -		if (!domain)
> +		if (!domain) {
> +			of_node_put(np);
>  			break;
> +		}
>  
>  		domain->pmu = pmu;
>  		domain->base.name = kasprintf(GFP_KERNEL, "%pOFn", np);
>  		if (!domain->base.name) {
>  			kfree(domain);
> +			of_node_put(np);
>  			break;
>  		}
>  
>

-- 
Gregory Clement, Bootlin
Embedded Linux and Kernel engineering
http://bootlin.com

WARNING: multiple messages have this Message-ID (diff)
From: Gregory CLEMENT <gregory.clement@bootlin.com>
To: Julia Lawall <Julia.Lawall@inria.fr>, Andrew Lunn <andrew@lunn.ch>
Cc: kernel-janitors@vger.kernel.org,
	Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 07/11] soc: dove: add missing of_node_put
Date: Wed, 20 Sep 2023 11:30:30 +0200	[thread overview]
Message-ID: <87jzslfayx.fsf@BL-laptop> (raw)
In-Reply-To: <20230907095521.14053-8-Julia.Lawall@inria.fr>

Julia Lawall <Julia.Lawall@inria.fr> writes:

> for_each_available_child_of_node performs an of_node_get
> on each iteration, so a break out of the loop requires an
> of_node_put.
>
> This was done using the Coccinelle semantic patch
> iterators/for_each_child.cocci
>
> Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>

Applied on mvebu/arm

Thanks,

Gregory
>
> ---
>  drivers/soc/dove/pmu.c |    5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff -u -p a/drivers/soc/dove/pmu.c b/drivers/soc/dove/pmu.c
> --- a/drivers/soc/dove/pmu.c
> +++ b/drivers/soc/dove/pmu.c
> @@ -410,13 +410,16 @@ int __init dove_init_pmu(void)
>  		struct pmu_domain *domain;
>  
>  		domain = kzalloc(sizeof(*domain), GFP_KERNEL);
> -		if (!domain)
> +		if (!domain) {
> +			of_node_put(np);
>  			break;
> +		}
>  
>  		domain->pmu = pmu;
>  		domain->base.name = kasprintf(GFP_KERNEL, "%pOFn", np);
>  		if (!domain->base.name) {
>  			kfree(domain);
> +			of_node_put(np);
>  			break;
>  		}
>  
>

-- 
Gregory Clement, Bootlin
Embedded Linux and Kernel engineering
http://bootlin.com

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

  reply	other threads:[~2023-09-20  9:30 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-07  9:55 [PATCH 00/11] add missing of_node_put Julia Lawall
2023-09-07  9:55 ` Julia Lawall
2023-09-07  9:55 ` Julia Lawall
2023-09-07  9:55 ` Julia Lawall
2023-09-07  9:55 ` [PATCH 01/11] arm-cci: " Julia Lawall
2023-09-07  9:55 ` [PATCH 02/11] net: bcmasp: " Julia Lawall
2023-09-10 13:49   ` Simon Horman
2023-09-07  9:55 ` [PATCH 03/11] powerpc/powermac: " Julia Lawall
2023-09-07  9:55   ` Julia Lawall
2023-09-07  9:55 ` [PATCH 04/11] genpd: ti: " Julia Lawall
2023-09-07  9:55   ` Julia Lawall
2023-10-04 22:24   ` Ulf Hansson
2023-10-04 22:24     ` Ulf Hansson
2023-09-07  9:55 ` [PATCH 05/11] mmc: atmel-mci: " Julia Lawall
2023-09-07  9:55   ` Julia Lawall
2023-09-14 14:47   ` Ulf Hansson
2023-09-14 14:47     ` Ulf Hansson
2023-09-07  9:55 ` [PATCH 06/11] powerpc/kexec_file: " Julia Lawall
2023-09-07  9:55   ` Julia Lawall
2023-09-07  9:55 ` [PATCH 07/11] soc: dove: " Julia Lawall
2023-09-07  9:55   ` Julia Lawall
2023-09-20  9:30   ` Gregory CLEMENT [this message]
2023-09-20  9:30     ` Gregory CLEMENT
2023-09-07  9:55 ` [PATCH 08/11] thermal/of: " Julia Lawall
2023-09-11 15:12   ` Rafael J. Wysocki
2023-09-07  9:55 ` [PATCH 09/11] drm/mediatek: " Julia Lawall
2023-09-07  9:55   ` Julia Lawall
2023-09-07  9:55   ` Julia Lawall
2023-09-07  9:55 ` [PATCH 10/11] ASoC: rsnd: " Julia Lawall
2023-09-08  6:05   ` Kuninori Morimoto
2023-09-08  8:25     ` Julia Lawall
2023-09-10 22:43       ` Kuninori Morimoto
2023-09-07  9:55 ` [PATCH 11/11] media: platform: mtk-mdp3: " Julia Lawall
2023-09-07  9:55   ` Julia Lawall
2023-09-10 18:00 ` [PATCH 00/11] " patchwork-bot+netdevbpf
2023-09-10 18:00   ` patchwork-bot+netdevbpf
2023-09-10 18:00   ` patchwork-bot+netdevbpf
2023-09-10 18:00   ` patchwork-bot+netdevbpf
2023-09-11 15:08 ` (subset) " Mark Brown
2023-09-11 15:08   ` Mark Brown
2023-09-11 15:08   ` Mark Brown
2023-09-11 15:08   ` Mark Brown
2023-09-21  9:30 ` Michael Ellerman
2023-09-21  9:30   ` Michael Ellerman
2023-09-21  9:30   ` Michael Ellerman
2023-09-21  9:30   ` Michael Ellerman

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=87jzslfayx.fsf@BL-laptop \
    --to=gregory.clement@bootlin.com \
    --cc=Julia.Lawall@inria.fr \
    --cc=andrew@lunn.ch \
    --cc=kernel-janitors@vger.kernel.org \
    --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 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.