The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Matthias Brugger <matthias.bgg@gmail.com>
To: Fei Shao <fshao@chromium.org>,
	AngeloGioacchino Del Regno
	<angelogioacchino.delregno@collabora.com>
Cc: Bjorn Andersson <andersson@kernel.org>,
	Mathieu Poirier <mathieu.poirier@linaro.org>,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org,
	linux-remoteproc@vger.kernel.org
Subject: Re: [PATCH] remoteproc: mediatek: Use for_each_available_child_of_node_scoped()
Date: Wed, 10 Sep 2025 11:57:53 +0200	[thread overview]
Message-ID: <661a6938-859e-412b-ba28-dc6e56c39cf9@gmail.com> (raw)
In-Reply-To: <20250908044348.2402981-1-fshao@chromium.org>



On 08/09/2025 06:43, Fei Shao wrote:
> Use scoped for_each_available_child_of_node_scoped() to remove manual
> of_node_put() calls from early returns.
> 
> Signed-off-by: Fei Shao <fshao@chromium.org>

Reviewed-by: Matthias Brugger <matthias.bgg@gmail.com>

> ---
> 
>   drivers/remoteproc/mtk_scp.c | 7 +------
>   1 file changed, 1 insertion(+), 6 deletions(-)
> 
> diff --git a/drivers/remoteproc/mtk_scp.c b/drivers/remoteproc/mtk_scp.c
> index 8206a1766481..b123698feb52 100644
> --- a/drivers/remoteproc/mtk_scp.c
> +++ b/drivers/remoteproc/mtk_scp.c
> @@ -1234,7 +1234,6 @@ static int scp_add_multi_core(struct platform_device *pdev,
>   	struct device *dev = &pdev->dev;
>   	struct device_node *np = dev_of_node(dev);
>   	struct platform_device *cpdev;
> -	struct device_node *child;
>   	struct list_head *scp_list = &scp_cluster->mtk_scp_list;
>   	const struct mtk_scp_of_data **cluster_of_data;
>   	struct mtk_scp *scp, *temp;
> @@ -1243,11 +1242,10 @@ static int scp_add_multi_core(struct platform_device *pdev,
>   
>   	cluster_of_data = (const struct mtk_scp_of_data **)of_device_get_match_data(dev);
>   
> -	for_each_available_child_of_node(np, child) {
> +	for_each_available_child_of_node_scoped(np, child) {
>   		if (!cluster_of_data[core_id]) {
>   			ret = -EINVAL;
>   			dev_err(dev, "Not support core %d\n", core_id);
> -			of_node_put(child);
>   			goto init_fail;
>   		}
>   
> @@ -1255,7 +1253,6 @@ static int scp_add_multi_core(struct platform_device *pdev,
>   		if (!cpdev) {
>   			ret = -ENODEV;
>   			dev_err(dev, "Not found platform device for core %d\n", core_id);
> -			of_node_put(child);
>   			goto init_fail;
>   		}
>   
> @@ -1264,14 +1261,12 @@ static int scp_add_multi_core(struct platform_device *pdev,
>   		if (IS_ERR(scp)) {
>   			ret = PTR_ERR(scp);
>   			dev_err(dev, "Failed to initialize core %d rproc\n", core_id);
> -			of_node_put(child);
>   			goto init_fail;
>   		}
>   
>   		ret = rproc_add(scp->rproc);
>   		if (ret) {
>   			dev_err(dev, "Failed to add rproc of core %d\n", core_id);
> -			of_node_put(child);
>   			scp_free(scp);
>   			goto init_fail;
>   		}


  reply	other threads:[~2025-09-10  9:57 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-08  4:43 [PATCH] remoteproc: mediatek: Use for_each_available_child_of_node_scoped() Fei Shao
2025-09-10  9:57 ` Matthias Brugger [this message]
2025-09-10 10:55 ` Jonathan Cameron
2025-09-11  8:43   ` Fei Shao

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=661a6938-859e-412b-ba28-dc6e56c39cf9@gmail.com \
    --to=matthias.bgg@gmail.com \
    --cc=andersson@kernel.org \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=fshao@chromium.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-remoteproc@vger.kernel.org \
    --cc=mathieu.poirier@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