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 <[email protected]> --- sound/soc/bcm/cygnus-ssp.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/sound/soc/bcm/cygnus-ssp.c b/sound/soc/bcm/cygnus-ssp.c index e0ce0232eb1e..47706ae0a31f 100644 --- a/sound/soc/bcm/cygnus-ssp.c +++ b/sound/soc/bcm/cygnus-ssp.c @@ -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++; -- 2.54.0
