From: arnd@arndb.de (Arnd Bergmann)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 5/5] arm: add missing of_node_put
Date: Sat, 10 Oct 2015 23:15:43 +0200 [thread overview]
Message-ID: <8965654.Mi98YpI4rM@wuerfel> (raw)
In-Reply-To: <alpine.DEB.2.02.1510102307570.2053@localhost6.localdomain6>
On Saturday 10 October 2015 23:10:06 Julia Lawall wrote:
> On Sat, 10 Oct 2015, Arnd Bergmann wrote:
>
> > On Saturday 10 October 2015 14:30:54 Julia Lawall wrote:
> > > diff --git a/arch/arm/kernel/devtree.c b/arch/arm/kernel/devtree.c
> > > index 11c54de..432ff34 100644
> > > --- a/arch/arm/kernel/devtree.c
> > > +++ b/arch/arm/kernel/devtree.c
> > > @@ -143,6 +143,7 @@ void __init arm_dt_init_cpu_maps(void)
> > > "max cores %u, capping them\n",
> > > cpuidx, nr_cpu_ids)) {
> > > cpuidx = nr_cpu_ids;
> > > + of_node_put(cpu);
> > > break;
> > > }
> > >
> >
> > The same for_each_child_of_node() loop has three 'return' statements'
> > aside from the 'break' statement here. I think you should change your
> > semantic patch to cover both cases.
>
> It was intended to,
Ok, I saw that just after replying...
> but it seems that it's not working on the case where
> there is no argument to return.
> In any case, it's an opportunity to ask a question. Would one want a
> of_node_put in front of every return, or should the returns become gotos,
> to a single of_node_put after the current end of the function?
The two styles that I see in code I consider particularly clean are:
- have only one return statement in the function and use goto for
error handling
- avoid the goto and have the early return.
Mixing the two tends to make the function less readable, so I'd only
change it to use gotos if it can be done nicely for all cases.
Arnd
next prev parent reply other threads:[~2015-10-10 21:15 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-10 12:30 [PATCH 0/5] add missing of_node_put Julia Lawall
2015-10-10 12:30 ` [PATCH 3/5] ARM: shmobile: R-Mobile: " Julia Lawall
2015-10-12 0:16 ` Simon Horman
2015-10-12 7:18 ` Geert Uytterhoeven
2015-10-12 7:24 ` Julia Lawall
2015-10-12 7:26 ` Geert Uytterhoeven
2015-10-12 7:29 ` Thomas Petazzoni
2015-10-12 7:30 ` Geert Uytterhoeven
2015-10-10 12:30 ` [PATCH 5/5] arm: " Julia Lawall
2015-10-10 21:02 ` Arnd Bergmann
2015-10-10 21:08 ` Thomas Petazzoni
2015-10-10 21:12 ` Julia Lawall
2015-10-10 21:10 ` Julia Lawall
2015-10-10 21:15 ` Arnd Bergmann [this message]
2015-10-10 21:41 ` [PATCH 5/5 v2] " Julia Lawall
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=8965654.Mi98YpI4rM@wuerfel \
--to=arnd@arndb.de \
--cc=linux-arm-kernel@lists.infradead.org \
/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;
as well as URLs for NNTP newsgroup(s).