From: Jonathan Cameron <Jonathan.Cameron@Huawei.com>
To: Kousik Sanagavarapu <five231003@gmail.com>
Cc: Julia Lawall <julia.lawall@inria.fr>, Nishanth Menon <nm@ti.com>,
Santosh Shilimkar <ssantosh@kernel.org>,
Nathan Chancellor <nathan@kernel.org>,
Shuah Khan <skhan@linuxfoundation.org>,
"Javier Carrasco" <javier.carrasco.cruz@gmail.com>,
<linux-kernel@vger.kernel.org>,
<linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH v2 2/3] soc: ti: knav_qmss_queue: do device_node auto cleanup
Date: Fri, 5 Jul 2024 11:52:05 +0100 [thread overview]
Message-ID: <20240705115205.00006363@Huawei.com> (raw)
In-Reply-To: <20240703065710.13786-3-five231003@gmail.com>
On Wed, 3 Jul 2024 12:25:27 +0530
Kousik Sanagavarapu <five231003@gmail.com> wrote:
> Use scope based cleanup, instead of manual of_node_put() calls, which
> automatically free()s "struct device_node".
>
> While at it, refactor the code from knav_queue_probe() into the seperate
> functions to make auto cleanup look more neat.
>
> Doing the cleanup this way has the advantage of reducing the chance of
> memory leaks in case we need to read from new OF nodes in the future
> when we probe.
>
> Suggested-by: Julia Lawall <julia.lawall@inria.fr>
> Signed-off-by: Kousik Sanagavarapu <five231003@gmail.com>
One trivial thing inline
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> @@ -1668,6 +1686,25 @@ static int knav_queue_start_pdsps(struct knav_device *kdev)
> return 0;
> }
>
> +static int knav_queue_setup_pdsps(struct knav_device *kdev,
> + struct device_node *node)
> +{
> + struct device_node *pdsps __free(device_node) =
> + of_get_child_by_name(node, "pdsps");
> +
> + if (pdsps) {
> + int ret;
> +
> + ret = knav_queue_init_pdsps(kdev, pdsps);
> + if (ret)
> + return ret;
As per original style, readability slightly helped by
a blank line here.
> + ret = knav_queue_start_pdsps(kdev);
> + if (ret)
> + return ret;
> + }
> + return 0;
> +}
next prev parent reply other threads:[~2024-07-05 10:52 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-03 6:55 [PATCH v2 0/3] Do device node auto cleanup in drivers/soc/ti/ Kousik Sanagavarapu
2024-07-03 6:55 ` [PATCH v2 1/3] soc: ti: pruss: do device_node auto cleanup Kousik Sanagavarapu
2024-07-05 10:49 ` Jonathan Cameron
2024-07-03 6:55 ` [PATCH v2 2/3] soc: ti: knav_qmss_queue: " Kousik Sanagavarapu
2024-07-05 10:52 ` Jonathan Cameron [this message]
2024-07-03 6:55 ` [PATCH v2 3/3] soc: ti: pm33xx: " Kousik Sanagavarapu
2024-07-05 10:54 ` Jonathan Cameron
2024-07-05 11:11 ` Kousik Sanagavarapu
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=20240705115205.00006363@Huawei.com \
--to=jonathan.cameron@huawei.com \
--cc=five231003@gmail.com \
--cc=javier.carrasco.cruz@gmail.com \
--cc=julia.lawall@inria.fr \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nathan@kernel.org \
--cc=nm@ti.com \
--cc=skhan@linuxfoundation.org \
--cc=ssantosh@kernel.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).