]> www.infradead.org Git - users/hch/configfs.git/commitdiff
ASoC: simple-card: Use cleanup.h instead of devm_kfree()
authorKrzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Wed, 3 Jul 2024 12:11:02 +0000 (14:11 +0200)
committerMark Brown <broonie@kernel.org>
Mon, 8 Jul 2024 11:50:01 +0000 (12:50 +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-8-71219dfd0aef@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/generic/simple-card.c

index edbb6322e9be2229cd36bd02541d5bea42e0e14a..d2588f1ea54e52a0784b11ebd8d3be2a1b1fe857 100644 (file)
@@ -5,6 +5,7 @@
 // Copyright (C) 2012 Renesas Solutions Corp.
 // Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
 
+#include <linux/cleanup.h>
 #include <linux/clk.h>
 #include <linux/device.h>
 #include <linux/module.h>
@@ -727,7 +728,6 @@ static int simple_probe(struct platform_device *pdev)
        struct device *dev = &pdev->dev;
        struct device_node *np = dev->of_node;
        struct snd_soc_card *card;
-       struct link_info *li;
        int ret;
 
        /* Allocate the private data and the DAI link array */
@@ -741,7 +741,7 @@ static int simple_probe(struct platform_device *pdev)
        card->probe             = simple_soc_probe;
        card->driver_name       = "simple-card";
 
-       li = devm_kzalloc(dev, sizeof(*li), GFP_KERNEL);
+       struct link_info *li __free(kfree) = kzalloc(sizeof(*li), GFP_KERNEL);
        if (!li)
                return -ENOMEM;
 
@@ -818,7 +818,6 @@ static int simple_probe(struct platform_device *pdev)
        if (ret < 0)
                goto err;
 
-       devm_kfree(dev, li);
        return 0;
 err:
        simple_util_clean_reference(card);