From: Julia Lawall <julia.lawall@lip6.fr>
To: walter harms <wharms@bfs.de>
Cc: Andrew Donnellan <andrew.donnellan@au1.ibm.com>,
linuxppc-dev@lists.ozlabs.org, imunsie@au1.ibm.com,
fbarrat@linux.vnet.ibm.com, clombard@linux.vnet.ibm.com,
kernel-janitors@vger.kernel.org, elfring@users.sourceforge.net,
julia.lawall@lip6.fr, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] cxl: replace loop with for_each_child_of_node(), remove unneeded of_node_put()
Date: Fri, 29 Jul 2016 10:49:54 +0200 (CEST) [thread overview]
Message-ID: <alpine.DEB.2.10.1607291049380.2161@hadrien> (raw)
In-Reply-To: <579B1802.7070102@bfs.de>
On Fri, 29 Jul 2016, walter harms wrote:
>
>
> Am 29.07.2016 05:55, schrieb Andrew Donnellan:
> > Rewrite the cxl_guest_init_afu() loop in cxl_of_probe() to use
> > for_each_child_of_node() rather than a hand-coded for loop.
> >
> > Remove the useless of_node_put(afu_np) call after the loop, where it's
> > guaranteed that afu_np == NULL.
> >
> > Reported-by: SF Markus Elfring <elfring@users.sourceforge.net>
> > Reported-by: Julia Lawall <julia.lawall@lip6.fr>
> > Signed-off-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
> >
> > ---
> >
> > Checked the of_node_put() with Fred, he thinks it was probably just left
> > over from an earlier private version of the code and we can just get rid of
> > it.
> > ---
> > drivers/misc/cxl/of.c | 8 +++-----
> > 1 file changed, 3 insertions(+), 5 deletions(-)
> >
> > diff --git a/drivers/misc/cxl/of.c b/drivers/misc/cxl/of.c
> > index edc4583..ec175ea 100644
> > --- a/drivers/misc/cxl/of.c
> > +++ b/drivers/misc/cxl/of.c
> > @@ -460,7 +460,7 @@ int cxl_of_probe(struct platform_device *pdev)
> > struct device_node *afu_np = NULL;
> > struct cxl *adapter = NULL;
> > int ret;
> > - int slice, slice_ok;
> > + int slice = 0, slice_ok = 0;
> >
> > pr_devel("in %s\n", __func__);
> >
> > @@ -476,13 +476,13 @@ int cxl_of_probe(struct platform_device *pdev)
> > }
> >
> > /* init afu */
> > - slice_ok = 0;
> > - for (afu_np = NULL, slice = 0; (afu_np = of_get_next_child(np, afu_np)); slice++) {
> > + for_each_child_of_node(np, afu_np) {
> > if ((ret = cxl_guest_init_afu(adapter, slice, afu_np)))
> > dev_err(&pdev->dev, "AFU %i failed to initialise: %i\n",
> > slice, ret);
> > else
> > slice_ok++;
> > + slice++;
> > }
>
> while you are here ..
> you could move the assign out of the condition..
>
> ret = cxl_guest_init_afu(adapter, slice, afu_np);
> if (ret) ....
Yes, please.
julia
>
> just my 2 cents,
>
> re,
> wh
>
> >
> > if (slice_ok == 0) {
> > @@ -490,8 +490,6 @@ int cxl_of_probe(struct platform_device *pdev)
> > adapter->slices = 0;
> > }
> >
> > - if (afu_np)
> > - of_node_put(afu_np);
> > return 0;
> > }
> >
> --
> To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
next prev parent reply other threads:[~2016-07-29 8:48 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <5307CAA2.8060406@users.sourceforge.net>
[not found] ` <alpine.DEB.2.02.1402212321410.2043@localhost6.localdomain6>
[not found] ` <530A086E.8010901@users.sourceforge.net>
[not found] ` <alpine.DEB.2.02.1402231635510.1985@localhost6.localdomain6>
[not found] ` <530A72AA.3000601@users.sourceforge.net>
[not found] ` <alpine.DEB.2.02.1402240658210.2090@localhost6.localdomain6>
[not found] ` <530B5FB6.6010207@users.sourceforge.net>
[not found] ` <alpine.DEB.2.10.1402241710370.2074@hadrien>
[not found] ` <530C5E18.1020800@users.sourceforge.net>
[not found] ` <alpine.DEB.2.10.1402251014170.2080@hadrien>
[not found] ` <530CD2C4.4050903@users.sourceforge.net>
[not found] ` <alpine.DEB.2.10.1402251840450.7035@hadrien>
[not found] ` <530CF8FF.8080600@users.sourceforge.net>
[not found] ` <alpine.DEB.2.02.1402252117150.2047@localhost6.localdomain6>
[not found] ` <530DD06F.4090703@users.sourceforge.net>
[not found] ` <alpine.DEB.2.02.1402262129250.2221@localhost6.localdomain6>
[not found] ` <5317A59D.4@users.sourceforge.net>
2014-11-21 11:45 ` [PATCH 1/1] tty-hvsi_lib: Deletion of an unnecessary check before the function call "tty_kref_put" SF Markus Elfring
2014-11-22 15:26 ` [PATCH 1/1] PowerPC-83xx: Deletion of an unnecessary check before the function call "of_node_put" SF Markus Elfring
2014-12-02 21:55 ` [PATCH] ALSA: i2sbus: Deletion of unnecessary checks before the function call "release_and_free_resource" SF Markus Elfring
2014-12-03 6:59 ` Takashi Iwai
[not found] ` <54A9355F.4050102@users.sourceforge.net>
2015-01-04 13:21 ` [PATCH 9/13] ALSA: i2sbus: Delete an unnecessary check before the function call "snd_pcm_suspend_all" SF Markus Elfring
2015-01-04 13:36 ` [PATCH 11/13] ALSA: Deletion of checks before the function call "iounmap" SF Markus Elfring
2015-01-05 13:58 ` Dan Carpenter
2016-10-26 12:26 ` Dan Carpenter
2016-10-26 12:28 ` Johannes Berg
2016-10-26 12:42 ` Dan Carpenter
2015-02-03 13:00 ` [PATCH] PowerPC-PCI: Delete unnecessary checks before the function call "kfree" SF Markus Elfring
2015-02-03 13:38 ` [PATCH] PowerPC-rheap: Delete an unnecessary check " SF Markus Elfring
2015-02-04 20:36 ` [PATCH] macintosh: Delete an unnecessary check before the function call "of_node_put" SF Markus Elfring
2015-06-30 8:13 ` SF Markus Elfring
2015-11-06 10:05 ` [PATCH] cxl: Delete an unnecessary check before the function call "kfree" SF Markus Elfring
2015-11-08 22:56 ` Andrew Donnellan
2015-11-09 2:09 ` Ian Munsie
2016-04-13 13:33 ` Michael Ellerman
2016-07-20 13:20 ` [PATCH] cxl: Delete an unnecessary check before the function call "of_node_put" SF Markus Elfring
2016-07-20 13:38 ` Julia Lawall
2016-07-27 8:57 ` Andrew Donnellan
2016-07-29 3:55 ` [PATCH] cxl: replace loop with for_each_child_of_node(), remove unneeded of_node_put() Andrew Donnellan
2016-07-29 7:43 ` Frederic Barrat
2016-07-29 8:46 ` walter harms
2016-07-29 8:49 ` Julia Lawall [this message]
2016-07-29 11:38 ` Michael Ellerman
2016-08-01 13:34 ` Frederic Barrat
2016-10-05 2:36 ` 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=alpine.DEB.2.10.1607291049380.2161@hadrien \
--to=julia.lawall@lip6.fr \
--cc=andrew.donnellan@au1.ibm.com \
--cc=clombard@linux.vnet.ibm.com \
--cc=elfring@users.sourceforge.net \
--cc=fbarrat@linux.vnet.ibm.com \
--cc=imunsie@au1.ibm.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=wharms@bfs.de \
/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