ASoC: audio-graph-card2: Tidyup audio_graph2_parse_of() around error

audio_graph2_parse_of() have not been calling
simple_util_clean_reference(). Call it.

And it is already calling dev_err_probe() in error case, no need to
call graph_ret() in success case. Tidyup it.

Let's keep same style with simple-card/audio-graph-card.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://patch.msgid.link/87echmxizq.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Kuninori Morimoto 2026-07-02 01:44:57 +00:00 committed by Mark Brown
parent 7f20b9b05b
commit aa7fe27fda
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0

View File

@ -1303,11 +1303,11 @@ int audio_graph2_parse_of(struct simple_util_priv *priv, struct device *dev,
struct graph2_custom_hooks *hooks)
{
struct snd_soc_card *card = simple_priv_to_card(priv);
int ret;
int ret = -ENOMEM;
struct link_info *li __free(kfree) = kzalloc_obj(*li);
if (!li)
return -ENOMEM;
goto end;
card->probe = graph_util_card_probe;
card->owner = THIS_MODULE;
@ -1316,33 +1316,33 @@ int audio_graph2_parse_of(struct simple_util_priv *priv, struct device *dev,
if ((hooks) && (hooks)->hook_pre) {
ret = (hooks)->hook_pre(priv);
if (ret < 0)
goto err;
goto end;
}
ret = graph_for_each_link(priv, hooks, li, graph_count);
if (!li->link)
ret = -EINVAL;
if (ret < 0)
goto err;
goto end;
ret = simple_util_init_priv(priv, li);
if (ret < 0)
goto err;
goto end;
priv->pa_gpio = devm_gpiod_get_optional(dev, "pa", GPIOD_OUT_LOW);
if (IS_ERR(priv->pa_gpio)) {
ret = PTR_ERR(priv->pa_gpio);
dev_err(dev, "failed to get amplifier gpio: %d\n", ret);
goto err;
goto end;
}
ret = simple_util_parse_widgets(card, NULL);
if (ret < 0)
goto err;
goto end;
ret = simple_util_parse_routing(card, NULL);
if (ret < 0)
goto err;
goto end;
memset(li, 0, sizeof(*li));
ret = graph_for_each_link(priv, hooks, li, graph_link);
@ -1369,9 +1369,11 @@ int audio_graph2_parse_of(struct simple_util_priv *priv, struct device *dev,
ret = devm_snd_soc_register_card(dev, card);
err:
if (ret < 0)
dev_err_probe(dev, ret, "parse error\n");
if (ret < 0) {
simple_util_clean_reference(card);
return dev_err_probe(dev, ret, "parse error\n");
}
end:
return graph_ret(priv, ret);
}
EXPORT_SYMBOL_GPL(audio_graph2_parse_of);