From: Brian Norris <computersforpeace@gmail.com>
To: linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 11/14] ARM: brcmstb: delete unneeded test before of_node_put
Date: Thu, 14 Aug 2014 06:53:10 +0000 [thread overview]
Message-ID: <20140814065310.GK11952@brian-ubuntu> (raw)
In-Reply-To: <alpine.DEB.2.02.1408140733190.2053@localhost6.localdomain6>
On Thu, Aug 14, 2014 at 07:37:28AM +0200, Julia Lawall wrote:
> On Wed, 13 Aug 2014, Brian Norris wrote:
> > On Fri, Aug 08, 2014 at 12:07:52PM +0200, Julia Lawall wrote:
> > > diff --git a/arch/arm/mach-bcm/platsmp-brcmstb.c b/arch/arm/mach-bcm/platsmp-brcmstb.c
> > > index af780e9..c515ea1 100644
> > > --- a/arch/arm/mach-bcm/platsmp-brcmstb.c
> > > +++ b/arch/arm/mach-bcm/platsmp-brcmstb.c
> > > @@ -227,7 +227,7 @@ static int __init setup_hifcpubiuctrl_regs(struct device_node *np)
> > > if (!syscon_np) {
> > > pr_err("can't find phandle %s\n", name);
> > > rc = -EINVAL;
> > > - goto cleanup;
> > > + goto out;
> > > }
> > >
> > > cpubiuctrl_block = of_iomap(syscon_np, 0);
> > > @@ -256,9 +256,8 @@ static int __init setup_hifcpubiuctrl_regs(struct device_node *np)
> > > }
> > >
> > > cleanup:
> > > - if (syscon_np)
> > > - of_node_put(syscon_np);
> > > -
> > > + of_node_put(syscon_np);
> > > +out:
> >
> > Is there a good reason for this new label? I thought part of the point
> > of this semantic patch is that the previous line (of_node_put()) is a
> > no-op for NULL arguments.
>
> Personally, I prefer code to only be executed if it needs to be. It is
> helpful from a program analysis point of view, and I think it helps
> someone trying to understand the code.
>
> That is, when I am trying to understand some unknown code, I may look at
> the cleanup code and try to figure out why each piece of it is executed.
> If some of it is statically known to be irrelevant, it is confusing.
>
> But I you think the other way around, and would rather have just one label
> that contains anything that might ever be useful, then I guess that is a
> reasonable point of view as well.
Yeah, I personally just look to avoid unnecessary labels.
Thanks for explaining your thought process.
Brian
WARNING: multiple messages have this Message-ID (diff)
From: computersforpeace@gmail.com (Brian Norris)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 11/14] ARM: brcmstb: delete unneeded test before of_node_put
Date: Wed, 13 Aug 2014 23:53:10 -0700 [thread overview]
Message-ID: <20140814065310.GK11952@brian-ubuntu> (raw)
In-Reply-To: <alpine.DEB.2.02.1408140733190.2053@localhost6.localdomain6>
On Thu, Aug 14, 2014 at 07:37:28AM +0200, Julia Lawall wrote:
> On Wed, 13 Aug 2014, Brian Norris wrote:
> > On Fri, Aug 08, 2014 at 12:07:52PM +0200, Julia Lawall wrote:
> > > diff --git a/arch/arm/mach-bcm/platsmp-brcmstb.c b/arch/arm/mach-bcm/platsmp-brcmstb.c
> > > index af780e9..c515ea1 100644
> > > --- a/arch/arm/mach-bcm/platsmp-brcmstb.c
> > > +++ b/arch/arm/mach-bcm/platsmp-brcmstb.c
> > > @@ -227,7 +227,7 @@ static int __init setup_hifcpubiuctrl_regs(struct device_node *np)
> > > if (!syscon_np) {
> > > pr_err("can't find phandle %s\n", name);
> > > rc = -EINVAL;
> > > - goto cleanup;
> > > + goto out;
> > > }
> > >
> > > cpubiuctrl_block = of_iomap(syscon_np, 0);
> > > @@ -256,9 +256,8 @@ static int __init setup_hifcpubiuctrl_regs(struct device_node *np)
> > > }
> > >
> > > cleanup:
> > > - if (syscon_np)
> > > - of_node_put(syscon_np);
> > > -
> > > + of_node_put(syscon_np);
> > > +out:
> >
> > Is there a good reason for this new label? I thought part of the point
> > of this semantic patch is that the previous line (of_node_put()) is a
> > no-op for NULL arguments.
>
> Personally, I prefer code to only be executed if it needs to be. It is
> helpful from a program analysis point of view, and I think it helps
> someone trying to understand the code.
>
> That is, when I am trying to understand some unknown code, I may look at
> the cleanup code and try to figure out why each piece of it is executed.
> If some of it is statically known to be irrelevant, it is confusing.
>
> But I you think the other way around, and would rather have just one label
> that contains anything that might ever be useful, then I guess that is a
> reasonable point of view as well.
Yeah, I personally just look to avoid unnecessary labels.
Thanks for explaining your thought process.
Brian
WARNING: multiple messages have this Message-ID (diff)
From: Brian Norris <computersforpeace@gmail.com>
To: Julia Lawall <julia.lawall@lip6.fr>
Cc: "Marc Carino" <marc.ceeeee@gmail.com>,
kernel-janitors@vger.kernel.org,
"Christian Daudt" <bcm@fixthebug.org>,
"Matt Porter" <mporter@linaro.org>,
"Russell King" <linux@arm.linux.org.uk>,
linux-arm-kernel@lists.infradead.org,
bcm-kernel-feedback-list@broadcom.com,
linux-kernel@vger.kernel.org,
"Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
Subject: Re: [PATCH 11/14] ARM: brcmstb: delete unneeded test before of_node_put
Date: Wed, 13 Aug 2014 23:53:10 -0700 [thread overview]
Message-ID: <20140814065310.GK11952@brian-ubuntu> (raw)
In-Reply-To: <alpine.DEB.2.02.1408140733190.2053@localhost6.localdomain6>
On Thu, Aug 14, 2014 at 07:37:28AM +0200, Julia Lawall wrote:
> On Wed, 13 Aug 2014, Brian Norris wrote:
> > On Fri, Aug 08, 2014 at 12:07:52PM +0200, Julia Lawall wrote:
> > > diff --git a/arch/arm/mach-bcm/platsmp-brcmstb.c b/arch/arm/mach-bcm/platsmp-brcmstb.c
> > > index af780e9..c515ea1 100644
> > > --- a/arch/arm/mach-bcm/platsmp-brcmstb.c
> > > +++ b/arch/arm/mach-bcm/platsmp-brcmstb.c
> > > @@ -227,7 +227,7 @@ static int __init setup_hifcpubiuctrl_regs(struct device_node *np)
> > > if (!syscon_np) {
> > > pr_err("can't find phandle %s\n", name);
> > > rc = -EINVAL;
> > > - goto cleanup;
> > > + goto out;
> > > }
> > >
> > > cpubiuctrl_block = of_iomap(syscon_np, 0);
> > > @@ -256,9 +256,8 @@ static int __init setup_hifcpubiuctrl_regs(struct device_node *np)
> > > }
> > >
> > > cleanup:
> > > - if (syscon_np)
> > > - of_node_put(syscon_np);
> > > -
> > > + of_node_put(syscon_np);
> > > +out:
> >
> > Is there a good reason for this new label? I thought part of the point
> > of this semantic patch is that the previous line (of_node_put()) is a
> > no-op for NULL arguments.
>
> Personally, I prefer code to only be executed if it needs to be. It is
> helpful from a program analysis point of view, and I think it helps
> someone trying to understand the code.
>
> That is, when I am trying to understand some unknown code, I may look at
> the cleanup code and try to figure out why each piece of it is executed.
> If some of it is statically known to be irrelevant, it is confusing.
>
> But I you think the other way around, and would rather have just one label
> that contains anything that might ever be useful, then I guess that is a
> reasonable point of view as well.
Yeah, I personally just look to avoid unnecessary labels.
Thanks for explaining your thought process.
Brian
next prev parent reply other threads:[~2014-08-14 6:53 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-08 10:07 [PATCH 11/14] ARM: brcmstb: delete unneeded test before of_node_put Julia Lawall
2014-08-08 10:07 ` Julia Lawall
2014-08-08 10:07 ` Julia Lawall
2014-08-13 22:22 ` Brian Norris
2014-08-13 22:22 ` Brian Norris
2014-08-13 22:22 ` Brian Norris
2014-08-14 5:37 ` Julia Lawall
2014-08-14 5:37 ` Julia Lawall
2014-08-14 5:37 ` Julia Lawall
2014-08-14 6:53 ` Brian Norris [this message]
2014-08-14 6:53 ` Brian Norris
2014-08-14 6:53 ` Brian Norris
2014-08-27 10:13 ` Dan Carpenter
2014-08-27 10:13 ` Dan Carpenter
2014-08-27 10:13 ` Dan Carpenter
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=20140814065310.GK11952@brian-ubuntu \
--to=computersforpeace@gmail.com \
--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 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.