]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
ASoC: audio-graph-card: Use cleanup.h instead of devm_kfree()
authorKrzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Wed, 3 Jul 2024 12:11:00 +0000 (14:11 +0200)
committerMark Brown <broonie@kernel.org>
Mon, 8 Jul 2024 11:49:59 +0000 (12:49 +0100)
Allocate the memory with scoped/cleanup.h, instead of devm interface, to
make the code more obvious that memory is not used outside this scope.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://patch.msgid.link/20240703-asoc-cleanup-h-v1-6-71219dfd0aef@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/generic/audio-graph-card.c

index acf7d92d21e60dc1ac9c087938bab5128720c952..3425fbbcbd7e9c6a580b8eb0739462bf21dfc051 100644 (file)
@@ -7,6 +7,7 @@
 //
 // based on ${LINUX}/sound/soc/generic/simple-card.c
 
+#include <linux/cleanup.h>
 #include <linux/clk.h>
 #include <linux/device.h>
 #include <linux/gpio/consumer.h>
@@ -573,10 +574,9 @@ static int graph_get_dais_count(struct simple_util_priv *priv,
 int audio_graph_parse_of(struct simple_util_priv *priv, struct device *dev)
 {
        struct snd_soc_card *card = simple_priv_to_card(priv);
-       struct link_info *li;
        int ret;
 
-       li = devm_kzalloc(dev, sizeof(*li), GFP_KERNEL);
+       struct link_info *li __free(kfree) = kzalloc(sizeof(*li), GFP_KERNEL);
        if (!li)
                return -ENOMEM;
 
@@ -628,7 +628,6 @@ int audio_graph_parse_of(struct simple_util_priv *priv, struct device *dev)
        if (ret < 0)
                goto err;
 
-       devm_kfree(dev, li);
        return 0;
 
 err: