diff options
| author | Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> | 2026-07-02 01:44:57 +0000 |
|---|---|---|
| committer | Mark Brown <broonie@kernel.org> | 2026-07-10 17:03:39 +0100 |
| commit | aa7fe27fda3241d33cd3af5cdeef4094c162cabb (patch) | |
| tree | 0476a647c39707eac5de2fecf068623e95d30dd2 /sound/soc/generic | |
| parent | 7f20b9b05b3abb619b6c951dfb7303525efc13c0 (diff) | |
| download | linux-next-aa7fe27fda3241d33cd3af5cdeef4094c162cabb.tar.gz linux-next-aa7fe27fda3241d33cd3af5cdeef4094c162cabb.zip | |
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>
Diffstat (limited to 'sound/soc/generic')
| -rw-r--r-- | sound/soc/generic/audio-graph-card2.c | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/sound/soc/generic/audio-graph-card2.c b/sound/soc/generic/audio-graph-card2.c index 0202ed0ee78e..c5ada1f83881 100644 --- a/sound/soc/generic/audio-graph-card2.c +++ b/sound/soc/generic/audio-graph-card2.c @@ -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); |
