Skip to content

Commit 9741aad

Browse files
CassivsGabriellisbroonie
authored andcommitted
ASoC: bcm: cygnus: use scoped child node loop
cygnus_ssp_probe() manually puts the current child node before returning from the child parsing loop on error. Use for_each_available_child_of_node_scoped() so the current child node is released automatically on early return and normal loop exit. Signed-off-by: Cássio Gabriel <cassiogabrielcontato@gmail.com> Link: https://patch.msgid.link/20260608-asoc-of-node-scoped-cleanup-v1-3-9e3ac518dc2e@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 065df02 commit 9741aad

1 file changed

Lines changed: 4 additions & 6 deletions

File tree

sound/soc/bcm/cygnus-ssp.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1298,7 +1298,6 @@ static int audio_clk_init(struct platform_device *pdev,
12981298
static int cygnus_ssp_probe(struct platform_device *pdev)
12991299
{
13001300
struct device *dev = &pdev->dev;
1301-
struct device_node *child_node;
13021301
struct cygnus_audio *cygaud;
13031302
int err;
13041303
int node_count;
@@ -1331,16 +1330,15 @@ static int cygnus_ssp_probe(struct platform_device *pdev)
13311330

13321331
active_port_count = 0;
13331332

1334-
for_each_available_child_of_node(pdev->dev.of_node, child_node) {
1333+
for_each_available_child_of_node_scoped(pdev->dev.of_node, child_node) {
13351334
err = parse_ssp_child_node(pdev, child_node, cygaud,
13361335
&cygnus_ssp_dai[active_port_count]);
13371336

13381337
/* negative is err, 0 is active and good, 1 is disabled */
1339-
if (err < 0) {
1340-
of_node_put(child_node);
1338+
if (err < 0)
13411339
return err;
1342-
}
1343-
else if (!err) {
1340+
1341+
if (!err) {
13441342
dev_dbg(dev, "Activating DAI: %s\n",
13451343
cygnus_ssp_dai[active_port_count].name);
13461344
active_port_count++;

0 commit comments

Comments
 (0)