]> git.itanic.dy.fi Git - linux-stable/commitdiff
ASoC: sprd: Simplify memory allocation in sprd_platform_compr_dma_config()
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Tue, 19 Dec 2023 04:41:19 +0000 (05:41 +0100)
committerMark Brown <broonie@kernel.org>
Tue, 19 Dec 2023 14:02:50 +0000 (14:02 +0000)
'sg' is freed at the end sprd_platform_compr_dma_config() both in the
normal and in the error handling path.

There is no need to use the devm_kcalloc()/devm_kfree(), kcalloc()/kfree()
is enough.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://msgid.link/r/d16f22ae0627249a9fc658927832590cd88c544e.1702960856.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/sprd/sprd-pcm-compress.c

index 6cfab8844d0f814c6cc8de3ae26e693f5fe0b6e3..57bd1a0728ac25cb9dc53c3f0702b83316c20fe6 100644 (file)
@@ -160,7 +160,7 @@ static int sprd_platform_compr_dma_config(struct snd_soc_component *component,
                return -ENODEV;
        }
 
-       sgt = sg = devm_kcalloc(dev, sg_num, sizeof(*sg), GFP_KERNEL);
+       sgt = sg = kcalloc(sg_num, sizeof(*sg), GFP_KERNEL);
        if (!sg) {
                ret = -ENOMEM;
                goto sg_err;
@@ -250,12 +250,12 @@ static int sprd_platform_compr_dma_config(struct snd_soc_component *component,
                dma->desc->callback_param = cstream;
        }
 
-       devm_kfree(dev, sg);
+       kfree(sg);
 
        return 0;
 
 config_err:
-       devm_kfree(dev, sg);
+       kfree(sg);
 sg_err:
        dma_release_channel(dma->chan);
        return ret;