summaryrefslogtreecommitdiff
path: root/sound/soc/qcom
diff options
context:
space:
mode:
authorKrzysztof Kozlowski <krzysztof.kozlowski@linaro.org>2024-07-01 19:19:17 +0200
committerMark Brown <broonie@kernel.org>2024-07-09 22:50:48 +0100
commita8915e2fe86c29304a3038f269f4667b371b87d2 (patch)
tree7706cc461e84ed7dcf51c34d8e58d6d5e5f16456 /sound/soc/qcom
parentd0f4ce8a28dd992579949b8ea2df810c4b5fe9b5 (diff)
ASoC: qcom: topology: Simplify with cleanup.h
Allocate memory, which is being freed at end of the scope, with scoped/cleanup.h to reduce number of error paths and make code a bit simpler. Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Link: https://patch.msgid.link/20240701171917.596173-2-krzysztof.kozlowski@linaro.org Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/qcom')
-rw-r--r--sound/soc/qcom/qdsp6/topology.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/sound/soc/qcom/qdsp6/topology.c b/sound/soc/qcom/qdsp6/topology.c
index f4d62ea60baa..83319a928f29 100644
--- a/sound/soc/qcom/qdsp6/topology.c
+++ b/sound/soc/qcom/qdsp6/topology.c
@@ -1,6 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
// Copyright (c) 2020, Linaro Limited
+#include <linux/cleanup.h>
#include <sound/soc.h>
#include <sound/soc-dapm.h>
#include <sound/pcm.h>
@@ -1288,18 +1289,19 @@ int audioreach_tplg_init(struct snd_soc_component *component)
struct snd_soc_card *card = component->card;
struct device *dev = component->dev;
const struct firmware *fw;
- char *tplg_fw_name;
int ret;
/* Inline with Qualcomm UCM configs and linux-firmware path */
- tplg_fw_name = kasprintf(GFP_KERNEL, "qcom/%s/%s-tplg.bin", card->driver_name, card->name);
+ char *tplg_fw_name __free(kfree) = kasprintf(GFP_KERNEL, "qcom/%s/%s-tplg.bin",
+ card->driver_name,
+ card->name);
if (!tplg_fw_name)
return -ENOMEM;
ret = request_firmware(&fw, tplg_fw_name, dev);
if (ret < 0) {
dev_err(dev, "tplg firmware loading %s failed %d\n", tplg_fw_name, ret);
- goto err;
+ return ret;
}
ret = snd_soc_tplg_component_load(component, &audioreach_tplg_ops, fw);
@@ -1309,8 +1311,6 @@ int audioreach_tplg_init(struct snd_soc_component *component)
}
release_firmware(fw);
-err:
- kfree(tplg_fw_name);
return ret;
}