[PATCH] ASoC: meson: aiu-fifo.c: use devm_kzalloc(), and remove .remove function

Kuninori Morimoto kuninori.morimoto.gx at renesas.com
Fri Sep 9 03:21:53 CEST 2022


From: Kuninori Morimoto <kuninori.morimoto.gx at renesas.com>

Current aiu-fifo.c is using kzalloc()/kfree(), but we can replace
it by devm_kzalloc(), and remove kfree().
This patch do it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx at renesas.com>
---
 sound/soc/meson/aiu-fifo.c | 10 +---------
 sound/soc/meson/aiu-fifo.h |  1 -
 sound/soc/meson/aiu.c      |  2 --
 3 files changed, 1 insertion(+), 12 deletions(-)

diff --git a/sound/soc/meson/aiu-fifo.c b/sound/soc/meson/aiu-fifo.c
index d67ff4cdabd5..843e5067e07d 100644
--- a/sound/soc/meson/aiu-fifo.c
+++ b/sound/soc/meson/aiu-fifo.c
@@ -196,7 +196,7 @@ int aiu_fifo_dai_probe(struct snd_soc_dai *dai)
 {
 	struct aiu_fifo *fifo;
 
-	fifo = kzalloc(sizeof(*fifo), GFP_KERNEL);
+	fifo = devm_kzalloc(dai->dev, sizeof(*fifo), GFP_KERNEL);
 	if (!fifo)
 		return -ENOMEM;
 
@@ -204,11 +204,3 @@ int aiu_fifo_dai_probe(struct snd_soc_dai *dai)
 
 	return 0;
 }
-
-int aiu_fifo_dai_remove(struct snd_soc_dai *dai)
-{
-	kfree(dai->playback_dma_data);
-
-	return 0;
-}
-
diff --git a/sound/soc/meson/aiu-fifo.h b/sound/soc/meson/aiu-fifo.h
index 42ce266677cc..fb323a4385f7 100644
--- a/sound/soc/meson/aiu-fifo.h
+++ b/sound/soc/meson/aiu-fifo.h
@@ -26,7 +26,6 @@ struct aiu_fifo {
 };
 
 int aiu_fifo_dai_probe(struct snd_soc_dai *dai);
-int aiu_fifo_dai_remove(struct snd_soc_dai *dai);
 
 snd_pcm_uframes_t aiu_fifo_pointer(struct snd_soc_component *component,
 				   struct snd_pcm_substream *substream);
diff --git a/sound/soc/meson/aiu.c b/sound/soc/meson/aiu.c
index 88e611e64d14..7e632aa31368 100644
--- a/sound/soc/meson/aiu.c
+++ b/sound/soc/meson/aiu.c
@@ -123,7 +123,6 @@ static struct snd_soc_dai_driver aiu_cpu_dai_drv[] = {
 		.ops		= &aiu_fifo_i2s_dai_ops,
 		.pcm_new	= aiu_fifo_pcm_new,
 		.probe		= aiu_fifo_i2s_dai_probe,
-		.remove		= aiu_fifo_dai_remove,
 	},
 	[CPU_SPDIF_FIFO] = {
 		.name = "SPDIF FIFO",
@@ -139,7 +138,6 @@ static struct snd_soc_dai_driver aiu_cpu_dai_drv[] = {
 		.ops		= &aiu_fifo_spdif_dai_ops,
 		.pcm_new	= aiu_fifo_pcm_new,
 		.probe		= aiu_fifo_spdif_dai_probe,
-		.remove		= aiu_fifo_dai_remove,
 	},
 	[CPU_I2S_ENCODER] = {
 		.name = "I2S Encoder",
-- 
2.25.1



More information about the Alsa-devel mailing list