From nobody Mon Feb 9 07:49:00 2026 Received: from mailgw.kylinos.cn (mailgw.kylinos.cn [124.126.103.232]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0EF621F152D; Tue, 3 Jun 2025 05:51:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=124.126.103.232 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748929889; cv=none; b=p3NcRFCFfHEOo9RSY9GUtybzQLH9nj2jYF6hwL0yb2YIUmhMjUjVlia32GUc6tKMzRgzVZZJizgUjVdNA4Y4gxozkWndYcbvY9NIfgPKLwTCFmRBlRMiEOOtTCyX/p8xEAqBXtDNrocQXZavOtLT2NdlkKr7ycB6ACosLiwdA7Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748929889; c=relaxed/simple; bh=6DdQtiGFxQaiDIO2uSARxYarp5J+wHjzYtW/u6Hxxdo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=jaB5rFlUs77ezKTkReNfVNPFb/6wlP8JkGcMKniJyI2ItenWzkzB+8WIQAKmtzbsBRZspupKBZ0M9pES9prMa8OKBWJohs+d2Uv9oalH7otjvqC1AATi/MAGjP7GIarPLLor00l5BTD73Gnc6Jg5BumfvTdaTdKXDoWk00U13zY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn; spf=pass smtp.mailfrom=kylinos.cn; arc=none smtp.client-ip=124.126.103.232 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kylinos.cn X-UUID: c6c64288403e11f0b29709d653e92f7d-20250603 X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.45,REQID:2fd0565f-3054-47c2-a3c7-33ac47588001,IP:0,U RL:0,TC:0,Content:0,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION: release,TS:0 X-CID-META: VersionHash:6493067,CLOUDID:a4388713d63cb4b1e886bed20fbf95f3,BulkI D:nil,BulkQuantity:0,Recheck:0,SF:81|82|102,TC:nil,Content:0|50,EDM:-3,IP: nil,URL:0,File:nil,RT:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV:0,L ES:1,SPR:NO,DKR:0,DKP:0,BRR:0,BRE:0,ARC:0 X-CID-BVR: 0 X-CID-BAS: 0,_,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR X-UUID: c6c64288403e11f0b29709d653e92f7d-20250603 Received: from node4.com.cn [(10.44.16.170)] by mailgw.kylinos.cn (envelope-from ) (Generic MTA) with ESMTP id 1836277498; Tue, 03 Jun 2025 13:51:21 +0800 Received: from node4.com.cn (localhost [127.0.0.1]) by node4.com.cn (NSMail) with SMTP id 4A8BC16001CC7; Tue, 3 Jun 2025 13:51:21 +0800 (CST) X-ns-mid: postfix-683E8D59-13836574 Received: from kylin-pc.. (unknown [172.25.130.133]) by node4.com.cn (NSMail) with ESMTPA id 14BEB16001A05; Tue, 3 Jun 2025 05:51:18 +0000 (UTC) From: Ai Chao To: perex@perex.cz, tiwai@suse.com, kuninori.morimoto.gx@renesas.com, lgirdwood@gmail.com, broonie@kernel.org, jbrunet@baylibre.com, neil.armstrong@linaro.org, khilman@baylibre.com, martin.blumenstingl@googlemail.com, shengjiu.wang@gmail.com, Xiubo.Lee@gmail.com, festevam@gmail.com, nicoleotsuka@gmail.com, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de Cc: linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org, Ai Chao Subject: [PATCH v4 1/4] ALSA: ppc: Use helper function for_each_child_of_node_scoped() Date: Tue, 3 Jun 2025 13:51:06 +0800 Message-ID: <20250603055109.3154061-2-aichao@kylinos.cn> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250603055109.3154061-1-aichao@kylinos.cn> References: <20250603055109.3154061-1-aichao@kylinos.cn> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The for_each_child_of_node_scoped() helper provides a scope-based clean-up functionality to put the device_node automatically, and as such, there is no need to call of_node_put() directly. Signed-off-by: Ai Chao --- sound/ppc/tumbler.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/sound/ppc/tumbler.c b/sound/ppc/tumbler.c index 3c09660e1522..b81d0789b9fb 100644 --- a/sound/ppc/tumbler.c +++ b/sound/ppc/tumbler.c @@ -1343,7 +1343,7 @@ int snd_pmac_tumbler_init(struct snd_pmac *chip) int i, err; struct pmac_tumbler *mix; const u32 *paddr; - struct device_node *tas_node, *np; + struct device_node *tas_node; char *chipname; =20 request_module("i2c-powermac"); @@ -1358,13 +1358,12 @@ int snd_pmac_tumbler_init(struct snd_pmac *chip) mix->anded_reset =3D 0; mix->reset_on_sleep =3D 1; =20 - for_each_child_of_node(chip->node, np) { + for_each_child_of_node_scoped(chip->node, np) { if (of_node_name_eq(np, "sound")) { if (of_property_read_bool(np, "has-anded-reset")) mix->anded_reset =3D 1; if (of_property_present(np, "layout-id")) mix->reset_on_sleep =3D 0; - of_node_put(np); break; } } --=20 2.47.1 From nobody Mon Feb 9 07:49:00 2026 Received: from mailgw.kylinos.cn (mailgw.kylinos.cn [124.126.103.232]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D5BF62040A7; Tue, 3 Jun 2025 05:51:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=124.126.103.232 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748929892; cv=none; b=HYn+1ZSlVTJT3rrfilSoIaliUAOyrf9BBdLJm4nsf0CoQ/Gy1H0peT6YdCakwAuyQmYHIPHalqqZsokjihbsG1h/kcM1S0/hCJ+Wa2nI2ApS29fLZP1RmyxjHMMVrT6CIOgegFwhiNe9f0zgRK8pO2JCh9GAWdsD92hWTY8FXCc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748929892; c=relaxed/simple; bh=Pp5hCozPaFfoJiM9YiT0wEelFpqRUnczi5faR6Squ2Q=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=PriG3XUswxIhWMpgZU+O0ANhRB+rwFYYJuGLuRjAw/4i5PRxi2E/q8JPL6pZJkdtjUKZ7qg3LlmHvSeqmyPrBnPQoCT2LbM05aAVCzN5Uc71aOgAGj4d4pS1g3uHQWzZluVRfH7s6DvptoFp801YmcxxYYzf1ZcOodRTqQeKcqI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn; spf=pass smtp.mailfrom=kylinos.cn; arc=none smtp.client-ip=124.126.103.232 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kylinos.cn X-UUID: c8b54382403e11f0b29709d653e92f7d-20250603 X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.45,REQID:df3b5439-5feb-4685-a003-4ebcb95eb9d8,IP:0,U RL:0,TC:0,Content:0,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION: release,TS:0 X-CID-META: VersionHash:6493067,CLOUDID:14aa14ce72d9ff01d2731399eb00e6bd,BulkI D:nil,BulkQuantity:0,Recheck:0,SF:81|82|102,TC:nil,Content:0|50,EDM:-3,IP: nil,URL:0,File:nil,RT:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV:0,L ES:1,SPR:NO,DKR:0,DKP:0,BRR:0,BRE:0,ARC:0 X-CID-BVR: 0 X-CID-BAS: 0,_,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR X-UUID: c8b54382403e11f0b29709d653e92f7d-20250603 Received: from node4.com.cn [(10.44.16.170)] by mailgw.kylinos.cn (envelope-from ) (Generic MTA) with ESMTP id 461440072; Tue, 03 Jun 2025 13:51:24 +0800 Received: from node4.com.cn (localhost [127.0.0.1]) by node4.com.cn (NSMail) with SMTP id 820D216001A00; Tue, 3 Jun 2025 13:51:24 +0800 (CST) X-ns-mid: postfix-683E8D5C-26255075 Received: from kylin-pc.. (unknown [172.25.130.133]) by node4.com.cn (NSMail) with ESMTPA id 91B2B16001CC7; Tue, 3 Jun 2025 05:51:22 +0000 (UTC) From: Ai Chao To: perex@perex.cz, tiwai@suse.com, kuninori.morimoto.gx@renesas.com, lgirdwood@gmail.com, broonie@kernel.org, jbrunet@baylibre.com, neil.armstrong@linaro.org, khilman@baylibre.com, martin.blumenstingl@googlemail.com, shengjiu.wang@gmail.com, Xiubo.Lee@gmail.com, festevam@gmail.com, nicoleotsuka@gmail.com, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de Cc: linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org, Ai Chao Subject: [PATCH v4 2/4] ASoC: renesas: Use helper function for_each_child_of_node_scoped() Date: Tue, 3 Jun 2025 13:51:07 +0800 Message-ID: <20250603055109.3154061-3-aichao@kylinos.cn> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250603055109.3154061-1-aichao@kylinos.cn> References: <20250603055109.3154061-1-aichao@kylinos.cn> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The for_each_child_of_node_scoped() helper provides a scope-based clean-up functionality to put the device_node automatically, and as such, there is no need to call of_node_put() directly. Acked-by: Kuninori Morimoto Signed-off-by: Ai Chao --- sound/soc/renesas/rcar/core.c | 35 +++++++++++------------------------ sound/soc/renesas/rcar/ctu.c | 8 ++------ sound/soc/renesas/rcar/dma.c | 4 +--- sound/soc/renesas/rcar/dvc.c | 8 ++------ sound/soc/renesas/rcar/mix.c | 8 ++------ sound/soc/renesas/rcar/src.c | 10 ++-------- sound/soc/renesas/rcar/ssi.c | 18 +++++------------- sound/soc/renesas/rcar/ssiu.c | 7 ++----- 8 files changed, 27 insertions(+), 71 deletions(-) diff --git a/sound/soc/renesas/rcar/core.c b/sound/soc/renesas/rcar/core.c index a72f36d3ca2c..37d954495ea5 100644 --- a/sound/soc/renesas/rcar/core.c +++ b/sound/soc/renesas/rcar/core.c @@ -1075,7 +1075,6 @@ static void rsnd_parse_tdm_split_mode(struct rsnd_pri= v *priv, { struct device *dev =3D rsnd_priv_to_dev(priv); struct device_node *ssiu_np =3D rsnd_ssiu_of_node(priv); - struct device_node *np; int is_play =3D rsnd_io_is_play(io); int i; =20 @@ -1094,7 +1093,7 @@ static void rsnd_parse_tdm_split_mode(struct rsnd_pri= v *priv, if (!node) break; =20 - for_each_child_of_node(ssiu_np, np) { + for_each_child_of_node_scoped(ssiu_np, np) { if (np =3D=3D node) { rsnd_flags_set(io, RSND_STREAM_TDM_SPLIT); dev_dbg(dev, "%s is part of TDM Split\n", io->name); @@ -1154,21 +1153,18 @@ void rsnd_parse_connect_common(struct rsnd_dai *rda= i, char *name, { struct rsnd_priv *priv =3D rsnd_rdai_to_priv(rdai); struct device *dev =3D rsnd_priv_to_dev(priv); - struct device_node *np; int i; =20 if (!node) return; =20 i =3D 0; - for_each_child_of_node(node, np) { + for_each_child_of_node_scoped(node, np) { struct rsnd_mod *mod; =20 i =3D rsnd_node_fixed_index(dev, np, name, i); - if (i < 0) { - of_node_put(np); + if (i < 0) break; - } =20 mod =3D mod_get(priv, i); =20 @@ -1217,16 +1213,13 @@ int rsnd_node_fixed_index(struct device *dev, struc= t device_node *node, char *na int rsnd_node_count(struct rsnd_priv *priv, struct device_node *node, char= *name) { struct device *dev =3D rsnd_priv_to_dev(priv); - struct device_node *np; int i; =20 i =3D 0; - for_each_child_of_node(node, np) { + for_each_child_of_node_scoped(node, np) { i =3D rsnd_node_fixed_index(dev, np, name, i); - if (i < 0) { - of_node_put(np); + if (i < 0) return 0; - } i++; } =20 @@ -1250,7 +1243,7 @@ static int rsnd_dai_of_node(struct rsnd_priv *priv, i= nt *is_graph) { struct device *dev =3D rsnd_priv_to_dev(priv); struct device_node *np =3D dev->of_node; - struct device_node *ports, *node; + struct device_node *node; int nr =3D 0; int i =3D 0; =20 @@ -1270,7 +1263,7 @@ static int rsnd_dai_of_node(struct rsnd_priv *priv, i= nt *is_graph) =20 of_node_put(node); =20 - for_each_child_of_node(np, node) { + for_each_child_of_node_scoped(np, node) { if (!of_node_name_eq(node, RSND_NODE_DAI)) continue; =20 @@ -1279,7 +1272,6 @@ static int rsnd_dai_of_node(struct rsnd_priv *priv, i= nt *is_graph) i++; if (i >=3D RSND_MAX_COMPONENT) { dev_info(dev, "reach to max component\n"); - of_node_put(node); break; } } @@ -1290,7 +1282,7 @@ static int rsnd_dai_of_node(struct rsnd_priv *priv, i= nt *is_graph) /* * Audio-Graph-Card */ - for_each_child_of_node(np, ports) { + for_each_child_of_node_scoped(np, ports) { node =3D rsnd_pick_endpoint_node_for_ports(ports, np); if (!node) continue; @@ -1299,7 +1291,6 @@ static int rsnd_dai_of_node(struct rsnd_priv *priv, i= nt *is_graph) i++; if (i >=3D RSND_MAX_COMPONENT) { dev_info(dev, "reach to max component\n"); - of_node_put(ports); break; } } @@ -1505,10 +1496,9 @@ static int rsnd_dai_probe(struct rsnd_priv *priv) dai_i =3D 0; if (is_graph) { struct device_node *dai_np_port; - struct device_node *ports; struct device_node *dai_np; =20 - for_each_child_of_node(np, ports) { + for_each_child_of_node_scoped(np, ports) { dai_np_port =3D rsnd_pick_endpoint_node_for_ports(ports, np); if (!dai_np_port) continue; @@ -1525,14 +1515,11 @@ static int rsnd_dai_probe(struct rsnd_priv *priv) } } } else { - struct device_node *node; - struct device_node *dai_np; - - for_each_child_of_node(np, node) { + for_each_child_of_node_scoped(np, node) { if (!of_node_name_eq(node, RSND_NODE_DAI)) continue; =20 - for_each_child_of_node(node, dai_np) { + for_each_child_of_node_scoped(node, dai_np) { __rsnd_dai_probe(priv, dai_np, np, dai_i, dai_i); if (!rsnd_is_gen1(priv) && !rsnd_is_gen2(priv)) { rdai =3D rsnd_rdai_get(priv, dai_i); diff --git a/sound/soc/renesas/rcar/ctu.c b/sound/soc/renesas/rcar/ctu.c index a26ec7b780cd..bd4c61f9fb3c 100644 --- a/sound/soc/renesas/rcar/ctu.c +++ b/sound/soc/renesas/rcar/ctu.c @@ -316,7 +316,6 @@ struct rsnd_mod *rsnd_ctu_mod_get(struct rsnd_priv *pri= v, int id) int rsnd_ctu_probe(struct rsnd_priv *priv) { struct device_node *node; - struct device_node *np; struct device *dev =3D rsnd_priv_to_dev(priv); struct rsnd_ctu *ctu; struct clk *clk; @@ -344,7 +343,7 @@ int rsnd_ctu_probe(struct rsnd_priv *priv) =20 i =3D 0; ret =3D 0; - for_each_child_of_node(node, np) { + for_each_child_of_node_scoped(node, np) { ctu =3D rsnd_ctu_get(priv, i); =20 /* @@ -357,16 +356,13 @@ int rsnd_ctu_probe(struct rsnd_priv *priv) clk =3D devm_clk_get(dev, name); if (IS_ERR(clk)) { ret =3D PTR_ERR(clk); - of_node_put(np); goto rsnd_ctu_probe_done; } =20 ret =3D rsnd_mod_init(priv, rsnd_mod_get(ctu), &rsnd_ctu_ops, clk, RSND_MOD_CTU, i); - if (ret) { - of_node_put(np); + if (ret) goto rsnd_ctu_probe_done; - } =20 i++; } diff --git a/sound/soc/renesas/rcar/dma.c b/sound/soc/renesas/rcar/dma.c index 2342bbb6fe92..2035ce06fe4c 100644 --- a/sound/soc/renesas/rcar/dma.c +++ b/sound/soc/renesas/rcar/dma.c @@ -194,14 +194,12 @@ struct dma_chan *rsnd_dma_request_channel(struct devi= ce_node *of_node, char *nam struct rsnd_priv *priv =3D rsnd_mod_to_priv(mod); struct device *dev =3D rsnd_priv_to_dev(priv); struct dma_chan *chan =3D NULL; - struct device_node *np; int i =3D 0; =20 - for_each_child_of_node(of_node, np) { + for_each_child_of_node_scoped(of_node, np) { i =3D rsnd_node_fixed_index(dev, np, name, i); if (i < 0) { chan =3D NULL; - of_node_put(np); break; } =20 diff --git a/sound/soc/renesas/rcar/dvc.c b/sound/soc/renesas/rcar/dvc.c index da91dd301aab..988cbddbc611 100644 --- a/sound/soc/renesas/rcar/dvc.c +++ b/sound/soc/renesas/rcar/dvc.c @@ -324,7 +324,6 @@ struct rsnd_mod *rsnd_dvc_mod_get(struct rsnd_priv *pri= v, int id) int rsnd_dvc_probe(struct rsnd_priv *priv) { struct device_node *node; - struct device_node *np; struct device *dev =3D rsnd_priv_to_dev(priv); struct rsnd_dvc *dvc; struct clk *clk; @@ -352,7 +351,7 @@ int rsnd_dvc_probe(struct rsnd_priv *priv) =20 i =3D 0; ret =3D 0; - for_each_child_of_node(node, np) { + for_each_child_of_node_scoped(node, np) { dvc =3D rsnd_dvc_get(priv, i); =20 snprintf(name, RSND_DVC_NAME_SIZE, "%s.%d", @@ -361,16 +360,13 @@ int rsnd_dvc_probe(struct rsnd_priv *priv) clk =3D devm_clk_get(dev, name); if (IS_ERR(clk)) { ret =3D PTR_ERR(clk); - of_node_put(np); goto rsnd_dvc_probe_done; } =20 ret =3D rsnd_mod_init(priv, rsnd_mod_get(dvc), &rsnd_dvc_ops, clk, RSND_MOD_DVC, i); - if (ret) { - of_node_put(np); + if (ret) goto rsnd_dvc_probe_done; - } =20 i++; } diff --git a/sound/soc/renesas/rcar/mix.c b/sound/soc/renesas/rcar/mix.c index 024d91cc8748..aea74e703305 100644 --- a/sound/soc/renesas/rcar/mix.c +++ b/sound/soc/renesas/rcar/mix.c @@ -288,7 +288,6 @@ struct rsnd_mod *rsnd_mix_mod_get(struct rsnd_priv *pri= v, int id) int rsnd_mix_probe(struct rsnd_priv *priv) { struct device_node *node; - struct device_node *np; struct device *dev =3D rsnd_priv_to_dev(priv); struct rsnd_mix *mix; struct clk *clk; @@ -316,7 +315,7 @@ int rsnd_mix_probe(struct rsnd_priv *priv) =20 i =3D 0; ret =3D 0; - for_each_child_of_node(node, np) { + for_each_child_of_node_scoped(node, np) { mix =3D rsnd_mix_get(priv, i); =20 snprintf(name, MIX_NAME_SIZE, "%s.%d", @@ -325,16 +324,13 @@ int rsnd_mix_probe(struct rsnd_priv *priv) clk =3D devm_clk_get(dev, name); if (IS_ERR(clk)) { ret =3D PTR_ERR(clk); - of_node_put(np); goto rsnd_mix_probe_done; } =20 ret =3D rsnd_mod_init(priv, rsnd_mod_get(mix), &rsnd_mix_ops, clk, RSND_MOD_MIX, i); - if (ret) { - of_node_put(np); + if (ret) goto rsnd_mix_probe_done; - } =20 i++; } diff --git a/sound/soc/renesas/rcar/src.c b/sound/soc/renesas/rcar/src.c index 7d73b183bda6..f47bf38c2f94 100644 --- a/sound/soc/renesas/rcar/src.c +++ b/sound/soc/renesas/rcar/src.c @@ -715,7 +715,6 @@ struct rsnd_mod *rsnd_src_mod_get(struct rsnd_priv *pri= v, int id) int rsnd_src_probe(struct rsnd_priv *priv) { struct device_node *node; - struct device_node *np; struct device *dev =3D rsnd_priv_to_dev(priv); struct rsnd_src *src; struct clk *clk; @@ -742,14 +741,13 @@ int rsnd_src_probe(struct rsnd_priv *priv) priv->src =3D src; =20 i =3D 0; - for_each_child_of_node(node, np) { + for_each_child_of_node_scoped(node, np) { if (!of_device_is_available(np)) goto skip; =20 i =3D rsnd_node_fixed_index(dev, np, SRC_NAME, i); if (i < 0) { ret =3D -EINVAL; - of_node_put(np); goto rsnd_src_probe_done; } =20 @@ -761,23 +759,19 @@ int rsnd_src_probe(struct rsnd_priv *priv) src->irq =3D irq_of_parse_and_map(np, 0); if (!src->irq) { ret =3D -EINVAL; - of_node_put(np); goto rsnd_src_probe_done; } =20 clk =3D devm_clk_get(dev, name); if (IS_ERR(clk)) { ret =3D PTR_ERR(clk); - of_node_put(np); goto rsnd_src_probe_done; } =20 ret =3D rsnd_mod_init(priv, rsnd_mod_get(src), &rsnd_src_ops, clk, RSND_MOD_SRC, i); - if (ret) { - of_node_put(np); + if (ret) goto rsnd_src_probe_done; - } =20 skip: i++; diff --git a/sound/soc/renesas/rcar/ssi.c b/sound/soc/renesas/rcar/ssi.c index 0c6424a1fcac..d52056caa3ec 100644 --- a/sound/soc/renesas/rcar/ssi.c +++ b/sound/soc/renesas/rcar/ssi.c @@ -1115,7 +1115,6 @@ void rsnd_parse_connect_ssi(struct rsnd_dai *rdai, struct rsnd_priv *priv =3D rsnd_rdai_to_priv(rdai); struct device *dev =3D rsnd_priv_to_dev(priv); struct device_node *node; - struct device_node *np; int i; =20 node =3D rsnd_ssi_of_node(priv); @@ -1123,14 +1122,12 @@ void rsnd_parse_connect_ssi(struct rsnd_dai *rdai, return; =20 i =3D 0; - for_each_child_of_node(node, np) { + for_each_child_of_node_scoped(node, np) { struct rsnd_mod *mod; =20 i =3D rsnd_node_fixed_index(dev, np, SSI_NAME, i); - if (i < 0) { - of_node_put(np); + if (i < 0) break; - } =20 mod =3D rsnd_ssi_mod_get(priv, i); =20 @@ -1163,7 +1160,6 @@ int __rsnd_ssi_is_pin_sharing(struct rsnd_mod *mod) int rsnd_ssi_probe(struct rsnd_priv *priv) { struct device_node *node; - struct device_node *np; struct device *dev =3D rsnd_priv_to_dev(priv); struct rsnd_mod_ops *ops; struct clk *clk; @@ -1191,14 +1187,13 @@ int rsnd_ssi_probe(struct rsnd_priv *priv) priv->ssi_nr =3D nr; =20 i =3D 0; - for_each_child_of_node(node, np) { + for_each_child_of_node_scoped(node, np) { if (!of_device_is_available(np)) goto skip; =20 i =3D rsnd_node_fixed_index(dev, np, SSI_NAME, i); if (i < 0) { ret =3D -EINVAL; - of_node_put(np); goto rsnd_ssi_probe_done; } =20 @@ -1210,7 +1205,6 @@ int rsnd_ssi_probe(struct rsnd_priv *priv) clk =3D devm_clk_get(dev, name); if (IS_ERR(clk)) { ret =3D PTR_ERR(clk); - of_node_put(np); goto rsnd_ssi_probe_done; } =20 @@ -1223,7 +1217,6 @@ int rsnd_ssi_probe(struct rsnd_priv *priv) ssi->irq =3D irq_of_parse_and_map(np, 0); if (!ssi->irq) { ret =3D -EINVAL; - of_node_put(np); goto rsnd_ssi_probe_done; } =20 @@ -1234,10 +1227,9 @@ int rsnd_ssi_probe(struct rsnd_priv *priv) =20 ret =3D rsnd_mod_init(priv, rsnd_mod_get(ssi), ops, clk, RSND_MOD_SSI, i); - if (ret) { - of_node_put(np); + if (ret) goto rsnd_ssi_probe_done; - } + skip: i++; } diff --git a/sound/soc/renesas/rcar/ssiu.c b/sound/soc/renesas/rcar/ssiu.c index 665e8b2db579..faf351126d57 100644 --- a/sound/soc/renesas/rcar/ssiu.c +++ b/sound/soc/renesas/rcar/ssiu.c @@ -478,17 +478,14 @@ void rsnd_parse_connect_ssiu(struct rsnd_dai *rdai, =20 /* use rcar_sound,ssiu if exist */ if (node) { - struct device_node *np; int i =3D 0; =20 - for_each_child_of_node(node, np) { + for_each_child_of_node_scoped(node, np) { struct rsnd_mod *mod; =20 i =3D rsnd_node_fixed_index(dev, np, SSIU_NAME, i); - if (i < 0) { - of_node_put(np); + if (i < 0) break; - } =20 mod =3D rsnd_ssiu_mod_get(priv, i); =20 --=20 2.47.1 From nobody Mon Feb 9 07:49:00 2026 Received: from mailgw.kylinos.cn (mailgw.kylinos.cn [124.126.103.232]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9F23E1F152D; Tue, 3 Jun 2025 05:51:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=124.126.103.232 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748929895; cv=none; b=uc3ptRBXLL92jfreTQOubOyj0yDyWGscqKOnViLT4krg+2R43LaYR45a8O6ec6M548IlzNxqADSPc7po1zNaD/V9pfaT3OY/oW8e7phtDnnsQVx8l+IW3gK4280cVIkkc3fjlNTF+asH7FXavI/RSXyMOfVTCDLGheWBeP3jpg4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748929895; c=relaxed/simple; bh=bwV4RkSu9n33EwTO6dbynPSir18jS1ePWZxOQ412vnc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ksnjd/4miUC8QJzvOdgdISHBO/g8qdUNffDTDkaz3Ror3LxPdzY9NGvTq8ZhyGGGRZ5y4QNieIcD2uvKS7+JG/3qSgT6cXCLp/psljSLV2xRvlsGW4sH8O0f+jT556CmxR2r73LseikV1qN7pR+hm2js9MedEnY7Sm9+yGkws/Y= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn; spf=pass smtp.mailfrom=kylinos.cn; arc=none smtp.client-ip=124.126.103.232 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kylinos.cn X-UUID: ca7c50de403e11f0b29709d653e92f7d-20250603 X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.45,REQID:4d406f31-bb9f-4539-97f8-67984e566c55,IP:0,U RL:0,TC:0,Content:0,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION: release,TS:0 X-CID-META: VersionHash:6493067,CLOUDID:332e54c45b2f535d18a25b4ddd08369a,BulkI D:nil,BulkQuantity:0,Recheck:0,SF:81|82|102,TC:nil,Content:0|50,EDM:-3,IP: nil,URL:99|1,File:nil,RT:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV: 0,LES:1,SPR:NO,DKR:0,DKP:0,BRR:0,BRE:0,ARC:0 X-CID-BVR: 0 X-CID-BAS: 0,_,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR,TF_CID_SPAM_ULS X-UUID: ca7c50de403e11f0b29709d653e92f7d-20250603 Received: from node4.com.cn [(10.44.16.170)] by mailgw.kylinos.cn (envelope-from ) (Generic MTA) with ESMTP id 614006275; Tue, 03 Jun 2025 13:51:27 +0800 Received: from node4.com.cn (localhost [127.0.0.1]) by node4.com.cn (NSMail) with SMTP id 822FD16001A00; Tue, 3 Jun 2025 13:51:27 +0800 (CST) X-ns-mid: postfix-683E8D5F-37825076 Received: from kylin-pc.. (unknown [172.25.130.133]) by node4.com.cn (NSMail) with ESMTPA id 5D43F16001CC7; Tue, 3 Jun 2025 05:51:25 +0000 (UTC) From: Ai Chao To: perex@perex.cz, tiwai@suse.com, kuninori.morimoto.gx@renesas.com, lgirdwood@gmail.com, broonie@kernel.org, jbrunet@baylibre.com, neil.armstrong@linaro.org, khilman@baylibre.com, martin.blumenstingl@googlemail.com, shengjiu.wang@gmail.com, Xiubo.Lee@gmail.com, festevam@gmail.com, nicoleotsuka@gmail.com, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de Cc: linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org, Ai Chao , kernel test robot Subject: [PATCH v4 3/4] ASoC: meson: Use helper function for_each_child_of_node_scoped() Date: Tue, 3 Jun 2025 13:51:08 +0800 Message-ID: <20250603055109.3154061-4-aichao@kylinos.cn> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250603055109.3154061-1-aichao@kylinos.cn> References: <20250603055109.3154061-1-aichao@kylinos.cn> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The for_each_child_of_node_scoped() helper provides a scope-based clean-up functionality to put the device_node automatically, and as such, there is no need to call of_node_put() directly. Reported-by: kernel test robot Closes: https://lore.kernel.org/oe-kbuild-all/202505210557.EpJig9BQ-lkp@int= el.com/ Signed-off-by: Ai Chao --- sound/soc/meson/axg-card.c | 3 +-- sound/soc/meson/meson-card-utils.c | 16 +++++----------- 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/sound/soc/meson/axg-card.c b/sound/soc/meson/axg-card.c index a2dfccb7990f..b4dca80e15e4 100644 --- a/sound/soc/meson/axg-card.c +++ b/sound/soc/meson/axg-card.c @@ -222,7 +222,6 @@ static int axg_card_parse_codecs_masks(struct snd_soc_c= ard *card, struct axg_dai_link_tdm_data *be) { struct axg_dai_link_tdm_mask *codec_mask; - struct device_node *np; =20 codec_mask =3D devm_kcalloc(card->dev, link->num_codecs, sizeof(*codec_mask), GFP_KERNEL); @@ -231,7 +230,7 @@ static int axg_card_parse_codecs_masks(struct snd_soc_c= ard *card, =20 be->codec_masks =3D codec_mask; =20 - for_each_child_of_node(node, np) { + for_each_child_of_node_scoped(node, np) { snd_soc_of_get_slot_mask(np, "dai-tdm-slot-rx-mask", &codec_mask->rx); snd_soc_of_get_slot_mask(np, "dai-tdm-slot-tx-mask", diff --git a/sound/soc/meson/meson-card-utils.c b/sound/soc/meson/meson-car= d-utils.c index 68531183fb60..cdb759b466ad 100644 --- a/sound/soc/meson/meson-card-utils.c +++ b/sound/soc/meson/meson-card-utils.c @@ -137,7 +137,6 @@ int meson_card_set_be_link(struct snd_soc_card *card, struct device_node *node) { struct snd_soc_dai_link_component *codec; - struct device_node *np; int ret, num_codecs; =20 num_codecs =3D of_get_child_count(node); @@ -154,19 +153,17 @@ int meson_card_set_be_link(struct snd_soc_card *card, link->codecs =3D codec; link->num_codecs =3D num_codecs; =20 - for_each_child_of_node(node, np) { + for_each_child_of_node_scoped(node, np) { ret =3D meson_card_parse_dai(card, np, codec); - if (ret) { - of_node_put(np); + if (ret) return ret; - } =20 codec++; } =20 ret =3D meson_card_set_link_name(card, link, node, "be"); if (ret) - dev_err(card->dev, "error setting %pOFn link name\n", np); + dev_err(card->dev, "error setting %pOFn link name\n", node); =20 return ret; } @@ -198,7 +195,6 @@ static int meson_card_add_links(struct snd_soc_card *ca= rd) { struct meson_card *priv =3D snd_soc_card_get_drvdata(card); struct device_node *node =3D card->dev->of_node; - struct device_node *np; int num, i, ret; =20 num =3D of_get_child_count(node); @@ -212,12 +208,10 @@ static int meson_card_add_links(struct snd_soc_card *= card) return ret; =20 i =3D 0; - for_each_child_of_node(node, np) { + for_each_child_of_node_scoped(node, np) { ret =3D priv->match_data->add_link(card, np, &i); - if (ret) { - of_node_put(np); + if (ret) return ret; - } =20 i++; } --=20 2.47.1 From nobody Mon Feb 9 07:49:00 2026 Received: from mailgw.kylinos.cn (mailgw.kylinos.cn [124.126.103.232]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9B7E0214A74; Tue, 3 Jun 2025 05:51:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=124.126.103.232 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748929898; cv=none; b=OxDb5nXSVlkj9t5cXPDqJZhU4u+XBHSQw7f/Q9/jJakciZVzUCh4A8yQeSn2nE/uu5ey2tt5zP8XIpwO2KgsqZRLPssqDjAEhHyyqTu9JeYPgoZsEBmdDW0c1V/IiQoJ5lfBXpIWltAqCsyWJfu/VgcWykvSWxXA4Af4wTjt9xA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748929898; c=relaxed/simple; bh=49TcfAQOEeJv/qCSz4O3cG+DCVUoRxfZZc4KzERXSmY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=C9UtgWS1NA16w6eIlFv5EpALIR0jq3j9TfCD50VNzsjy+4/vwxw35y7d6UhTN2namV8ECC+BGrjQ/wSBBEqZKw1ElSIb+6p9f1B04DwbXBddPUdtuf3pCYZ7xVqdfQE6BOuFhAuQ9l5VzeQByRXGarYuqo+C1nY1H0ODQWfGFTo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn; spf=pass smtp.mailfrom=kylinos.cn; arc=none smtp.client-ip=124.126.103.232 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kylinos.cn X-UUID: cd018a2c403e11f0b29709d653e92f7d-20250603 X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.45,REQID:d00fb2fc-8931-4d82-af9f-370910dd06d0,IP:0,U RL:0,TC:0,Content:0,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION: release,TS:0 X-CID-META: VersionHash:6493067,CLOUDID:82159c751699e0b2a3d463d53031854c,BulkI D:nil,BulkQuantity:0,Recheck:0,SF:81|82|102,TC:nil,Content:0|50,EDM:-3,IP: nil,URL:0,File:nil,RT:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV:0,L ES:1,SPR:NO,DKR:0,DKP:0,BRR:0,BRE:0,ARC:0 X-CID-BVR: 0 X-CID-BAS: 0,_,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR X-UUID: cd018a2c403e11f0b29709d653e92f7d-20250603 Received: from node4.com.cn [(10.44.16.170)] by mailgw.kylinos.cn (envelope-from ) (Generic MTA) with ESMTP id 918867262; Tue, 03 Jun 2025 13:51:32 +0800 Received: from node4.com.cn (localhost [127.0.0.1]) by node4.com.cn (NSMail) with SMTP id B8ECC16001A00; Tue, 3 Jun 2025 13:51:31 +0800 (CST) X-ns-mid: postfix-683E8D63-59658677 Received: from kylin-pc.. (unknown [172.25.130.133]) by node4.com.cn (NSMail) with ESMTPA id B945916001CC7; Tue, 3 Jun 2025 05:51:29 +0000 (UTC) From: Ai Chao To: perex@perex.cz, tiwai@suse.com, kuninori.morimoto.gx@renesas.com, lgirdwood@gmail.com, broonie@kernel.org, jbrunet@baylibre.com, neil.armstrong@linaro.org, khilman@baylibre.com, martin.blumenstingl@googlemail.com, shengjiu.wang@gmail.com, Xiubo.Lee@gmail.com, festevam@gmail.com, nicoleotsuka@gmail.com, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de Cc: linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org, Ai Chao Subject: [PATCH v4 4/4] ASoC: imx-card: Use helper function for_each_child_of_node_scoped() Date: Tue, 3 Jun 2025 13:51:09 +0800 Message-ID: <20250603055109.3154061-5-aichao@kylinos.cn> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250603055109.3154061-1-aichao@kylinos.cn> References: <20250603055109.3154061-1-aichao@kylinos.cn> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The for_each_child_of_node_scoped() helper provides a scope-based clean-up functionality to put the device_node automatically, and as such, there is no need to call of_node_put() directly. Signed-off-by: Ai Chao --- sound/soc/fsl/imx-card.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/sound/soc/fsl/imx-card.c b/sound/soc/fsl/imx-card.c index 9e668ae68039..ea5dbb54b584 100644 --- a/sound/soc/fsl/imx-card.c +++ b/sound/soc/fsl/imx-card.c @@ -513,7 +513,6 @@ static int imx_card_parse_of(struct imx_card_data *data) struct device_node *platform =3D NULL; struct device_node *codec =3D NULL; struct device_node *cpu =3D NULL; - struct device_node *np; struct device *dev =3D card->dev; struct snd_soc_dai_link *link; struct dai_link_data *link_data; @@ -552,11 +551,10 @@ static int imx_card_parse_of(struct imx_card_data *da= ta) link =3D card->dai_link; link_data =3D data->link_data; =20 - for_each_child_of_node(dev->of_node, np) { + for_each_child_of_node_scoped(dev->of_node, np) { dlc =3D devm_kzalloc(dev, 2 * sizeof(*dlc), GFP_KERNEL); if (!dlc) { - ret =3D -ENOMEM; - goto err_put_np; + return -ENOMEM; } =20 link->cpus =3D &dlc[0]; @@ -567,8 +565,8 @@ static int imx_card_parse_of(struct imx_card_data *data) =20 ret =3D of_property_read_string(np, "link-name", &link->name); if (ret) { - dev_err(card->dev, "error getting codec dai_link name\n"); - goto err_put_np; + return dev_err_probe(card->dev, ret, + "error getting codec dai_link name\n"); } =20 cpu =3D of_get_child_by_name(np, "cpu"); @@ -725,8 +723,7 @@ static int imx_card_parse_of(struct imx_card_data *data) of_node_put(cpu); of_node_put(codec); of_node_put(platform); -err_put_np: - of_node_put(np); + return ret; } =20 --=20 2.47.1