]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
ASoC: bcm: cygnus: use scoped child node loop
authorCássio Gabriel <cassiogabrielcontato@gmail.com>
Mon, 8 Jun 2026 13:39:13 +0000 (10:39 -0300)
committerMark Brown <broonie@kernel.org>
Fri, 12 Jun 2026 15:12:11 +0000 (16:12 +0100)
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>
sound/soc/bcm/cygnus-ssp.c

index e0ce0232eb1efb0bff6dda5c9fc41a68da815276..47706ae0a31f0a7c496c971e4765c31526797c40 100644 (file)
@@ -1298,7 +1298,6 @@ static int audio_clk_init(struct platform_device *pdev,
 static int cygnus_ssp_probe(struct platform_device *pdev)
 {
        struct device *dev = &pdev->dev;
-       struct device_node *child_node;
        struct cygnus_audio *cygaud;
        int err;
        int node_count;
@@ -1331,16 +1330,15 @@ static int cygnus_ssp_probe(struct platform_device *pdev)
 
        active_port_count = 0;
 
-       for_each_available_child_of_node(pdev->dev.of_node, child_node) {
+       for_each_available_child_of_node_scoped(pdev->dev.of_node, child_node) {
                err = parse_ssp_child_node(pdev, child_node, cygaud,
                                        &cygnus_ssp_dai[active_port_count]);
 
                /* negative is err, 0 is active and good, 1 is disabled */
-               if (err < 0) {
-                       of_node_put(child_node);
+               if (err < 0)
                        return err;
-               }
-               else if (!err) {
+
+               if (!err) {
                        dev_dbg(dev, "Activating DAI: %s\n",
                                cygnus_ssp_dai[active_port_count].name);
                        active_port_count++;