Skip to content

Commit 1b08e76

Browse files
tititiou36broonie
authored andcommitted
ASoC: sprd: Simplify memory allocation in sprd_platform_compr_dma_config()
'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>
1 parent 55d7bbe commit 1b08e76

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

sound/soc/sprd/sprd-pcm-compress.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ static int sprd_platform_compr_dma_config(struct snd_soc_component *component,
160160
return -ENODEV;
161161
}
162162

163-
sgt = sg = devm_kcalloc(dev, sg_num, sizeof(*sg), GFP_KERNEL);
163+
sgt = sg = kcalloc(sg_num, sizeof(*sg), GFP_KERNEL);
164164
if (!sg) {
165165
ret = -ENOMEM;
166166
goto sg_err;
@@ -250,12 +250,12 @@ static int sprd_platform_compr_dma_config(struct snd_soc_component *component,
250250
dma->desc->callback_param = cstream;
251251
}
252252

253-
devm_kfree(dev, sg);
253+
kfree(sg);
254254

255255
return 0;
256256

257257
config_err:
258-
devm_kfree(dev, sg);
258+
kfree(sg);
259259
sg_err:
260260
dma_release_channel(dma->chan);
261261
return ret;

0 commit comments

Comments
 (0)