From: Jonathan Cameron <jic23@kernel.org>
To: Jinjie Ruan <ruanjinjie@huawei.com>
Cc: Kousik Sanagavarapu <five231003@gmail.com>, <andrew@lunn.ch>,
<sebastian.hesselbarth@gmail.com>, <gregory.clement@bootlin.com>,
<herve.codina@bootlin.com>, <qiang.zhao@nxp.com>,
<christophe.leroy@csgroup.eu>, <thierry.reding@gmail.com>,
<jonathanh@nvidia.com>, <nm@ti.com>, <ssantosh@kernel.org>,
<petlozup@nvidia.com>, <pshete@nvidia.com>,
<christophe.jaillet@wanadoo.fr>, <ulf.hansson@linaro.org>,
<linux-arm-kernel@lists.infradead.org>,
<linux-kernel@vger.kernel.org>, <linuxppc-dev@lists.ozlabs.org>,
<linux-tegra@vger.kernel.org>, <krzk@kernel.org>,
jonathan.cameron@huawei.com
Subject: Re: [PATCH -next 8/8] soc: ti: knav_qmss_queue: Simplify with scoped for each OF child loop
Date: Sat, 31 Aug 2024 11:30:21 +0100 [thread overview]
Message-ID: <20240831113021.08a9010a@jic23-huawei> (raw)
In-Reply-To: <598efadd-da27-0be3-6d1c-dee50e71c811@huawei.com>
On Fri, 30 Aug 2024 11:24:14 +0800
Jinjie Ruan <ruanjinjie@huawei.com> wrote:
> On 2024/8/29 23:58, Kousik Sanagavarapu wrote:
> > Jinjie Ruan <ruanjinjie@huawei.com> writes:
> >> @@ -1080,17 +1080,13 @@ static int knav_queue_setup_regions(struct knav_device *kdev,
> >> {
> >> struct device *dev = kdev->dev;
> >> struct knav_region *region;
> >> - struct device_node *child;
> >> u32 temp[2];
> >> int ret;
> >>
> >> - for_each_child_of_node(regions, child) {
> >> + for_each_child_of_node_scoped(regions, child) {
> >
> > Are you sure using *_scoped() is better here? Since it seems that we
> > need the memory pointed to by "child" in cases where we don't go into an
> > error path.
>
> Hi, Jonathan, could you help review this code?
I don't understand the review comment.
The reference counting before and after this patch is the same, just
with the error path handled in a simpler fashion and the scope of
the child variable reduced.
>
> >
> >> region = devm_kzalloc(dev, sizeof(*region), GFP_KERNEL);
> >> - if (!region) {
> >> - of_node_put(child);
> >> - dev_err(dev, "out of memory allocating region\n");
> >> - return -ENOMEM;
> >> - }
> >> + if (!region)
> >> + return dev_err_probe(dev, -ENOMEM, "out of memory allocating region\n");
> >>
> >> region->name = knav_queue_find_name(child);
> >> of_property_read_u32(child, "id", ®ion->id);
> >
> > Similarly in most of the other cases in this series where a similar
> > change is done.
> >
> > Also FYI, as for dev_err_probe(), I think I covered all of them in this
> > file and a patch for it is currently sitting in ti-drivers-soc-next.
> >
> > Thanks
next prev parent reply other threads:[~2024-08-31 10:33 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-27 11:45 [PATCH -next 0/8] soc: Simplify with scoped for each OF child loop and dev_err_probe() Jinjie Ruan
2024-08-27 11:46 ` [PATCH -next 1/8] soc: fsl: cpm1: Simplify with scoped for each OF child loop Jinjie Ruan
2024-08-27 11:46 ` [PATCH -next 2/8] soc: fsl: cpm1: Simplify with dev_err_probe() Jinjie Ruan
2024-08-27 13:50 ` Krzysztof Kozlowski
2024-08-28 1:58 ` Jinjie Ruan
2024-08-28 13:08 ` Krzysztof Kozlowski
2024-08-29 2:25 ` Jinjie Ruan
2024-08-27 11:46 ` [PATCH -next 3/8] soc: fsl: cpm1: qmc: Simplify with scoped for each OF child Jinjie Ruan
2024-08-27 11:46 ` [PATCH -next 4/8] soc: fsl: cpm1: qmc: Simplify with dev_err_probe() Jinjie Ruan
2024-08-27 11:46 ` [PATCH -next 5/8] soc/tegra: pmc: Simplify with scoped for each OF child loop Jinjie Ruan
2024-08-27 11:46 ` [PATCH -next 6/8] soc: dove: " Jinjie Ruan
2024-08-27 11:46 ` [PATCH -next 7/8] soc: ti: knav_dma: " Jinjie Ruan
2024-08-27 11:46 ` [PATCH -next 8/8] soc: ti: knav_qmss_queue: " Jinjie Ruan
2024-08-29 15:58 ` Kousik Sanagavarapu
2024-08-29 18:06 ` Nishanth Menon
2024-08-30 3:24 ` Jinjie Ruan
2024-08-31 10:30 ` Jonathan Cameron [this message]
2024-08-29 15:43 ` (subset) [PATCH -next 0/8] soc: Simplify with scoped for each OF child loop and dev_err_probe() Thierry Reding
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=20240831113021.08a9010a@jic23-huawei \
--to=jic23@kernel.org \
--cc=andrew@lunn.ch \
--cc=christophe.jaillet@wanadoo.fr \
--cc=christophe.leroy@csgroup.eu \
--cc=five231003@gmail.com \
--cc=gregory.clement@bootlin.com \
--cc=herve.codina@bootlin.com \
--cc=jonathan.cameron@huawei.com \
--cc=jonathanh@nvidia.com \
--cc=krzk@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tegra@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=nm@ti.com \
--cc=petlozup@nvidia.com \
--cc=pshete@nvidia.com \
--cc=qiang.zhao@nxp.com \
--cc=ruanjinjie@huawei.com \
--cc=sebastian.hesselbarth@gmail.com \
--cc=ssantosh@kernel.org \
--cc=thierry.reding@gmail.com \
--cc=ulf.hansson@linaro.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).