summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Elfring <elfring@users.sourceforge.net>2026-06-17 09:33:45 +0200
committerMark Brown <broonie@kernel.org>2026-06-29 18:35:11 +0100
commita33e6fa400d174e7970d4efc30dd2e10911281ab (patch)
treec6e6b154ed094c153ff1b4b2db314be87d28fadb
parent012dfa0c45ecaadd48549938a9f35d1a329a2c5d (diff)
downloadlinux-stable-a33e6fa400d174e7970d4efc30dd2e10911281ab.tar.gz
linux-stable-a33e6fa400d174e7970d4efc30dd2e10911281ab.zip
ASoC: SOF: topology: Use more common error handling code in sof_link_load()
Use an additional label so that a bit of exception handling can be better reused at the end of this function implementation. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> Link: https://patch.msgid.link/40b93192-68d2-4de1-845b-9c9ba994a75b@web.de Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r--sound/soc/sof/topology.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/sound/soc/sof/topology.c b/sound/soc/sof/topology.c
index 42a2d90bb705..f709935593ef 100644
--- a/sound/soc/sof/topology.c
+++ b/sound/soc/sof/topology.c
@@ -1943,8 +1943,7 @@ static int sof_link_load(struct snd_soc_component *scomp, int index, struct snd_
private->array, le32_to_cpu(private->size));
if (ret < 0) {
dev_err(scomp->dev, "Failed tp parse common DAI link tokens\n");
- kfree(slink);
- return ret;
+ goto free_slink;
}
token_list = tplg_ops ? tplg_ops->token_list : NULL;
@@ -2013,8 +2012,8 @@ static int sof_link_load(struct snd_soc_component *scomp, int index, struct snd_
/* allocate memory for tuples array */
slink->tuples = kzalloc_objs(*slink->tuples, num_tuples);
if (!slink->tuples) {
- kfree(slink);
- return -ENOMEM;
+ ret = -ENOMEM;
+ goto free_slink;
}
if (token_list[SOF_DAI_LINK_TOKENS].tokens) {
@@ -2070,6 +2069,7 @@ out:
err:
kfree(slink->tuples);
+free_slink:
kfree(slink);
return ret;