[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240705115205.00006363@Huawei.com>
Date: Fri, 5 Jul 2024 11:52:05 +0100
From: Jonathan Cameron <Jonathan.Cameron@...wei.com>
To: Kousik Sanagavarapu <five231003@...il.com>
CC: Julia Lawall <julia.lawall@...ia.fr>, Nishanth Menon <nm@...com>, Santosh
Shilimkar <ssantosh@...nel.org>, Nathan Chancellor <nathan@...nel.org>, Shuah
Khan <skhan@...uxfoundation.org>, "Javier Carrasco"
<javier.carrasco.cruz@...il.com>, <linux-kernel@...r.kernel.org>,
<linux-arm-kernel@...ts.infradead.org>
Subject: Re: [PATCH v2 2/3] soc: ti: knav_qmss_queue: do device_node auto
cleanup
On Wed, 3 Jul 2024 12:25:27 +0530
Kousik Sanagavarapu <five231003@...il.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@...ia.fr>
> Signed-off-by: Kousik Sanagavarapu <five231003@...il.com>
One trivial thing inline
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@...wei.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;
> +}
Powered by blists - more mailing lists