[PATCH 4/4] ASoC: ux500: Do not allocate the DMA data on every DAI probe

Arina Kharlamova via B4 Relay devnull+arina.kharlamova.mbzuai.ac.ae at kernel.org
Tue Dec 1 11:12:00 PST 2026


From: Arina Kharlamova <arina.kharlamova at mbzuai.ac.ae>

ux500_msp_dai_of_probe() is the DAI probe callback and runs every
time a sound card binds the MSP DAI. It allocates the playback and
capture struct snd_dmaengine_dai_dma_data with devm_kzalloc_obj() on
the MSP platform device, so the two allocations are released only
when that device is unbound and every card bind adds two more.

Keep the two structures in struct ux500_msp_i2s_drvdata, which lives
as long as the platform device is bound, and only fill them in the
DAI probe.

Fixes: f382acbe163a ("ASoC: ux500: Store DMA data in the DAI differently in the pdata and DT case")
Signed-off-by: Arina Kharlamova <arina.kharlamova at mbzuai.ac.ae>
---
 sound/soc/ux500/ux500_msp_dai.c | 9 ++-------
 sound/soc/ux500/ux500_msp_dai.h | 4 ++++
 2 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/sound/soc/ux500/ux500_msp_dai.c b/sound/soc/ux500/ux500_msp_dai.c
index a8ad64e91936..d191298a6574 100644
--- a/sound/soc/ux500/ux500_msp_dai.c
+++ b/sound/soc/ux500/ux500_msp_dai.c
@@ -602,13 +602,8 @@ static int ux500_msp_dai_of_probe(struct snd_soc_dai *dai)
 	struct snd_dmaengine_dai_dma_data *playback_dma_data;
 	struct snd_dmaengine_dai_dma_data *capture_dma_data;
 
-	playback_dma_data = devm_kzalloc_obj(dai->dev, *playback_dma_data);
-	if (!playback_dma_data)
-		return -ENOMEM;
-
-	capture_dma_data = devm_kzalloc_obj(dai->dev, *capture_dma_data);
-	if (!capture_dma_data)
-		return -ENOMEM;
+	playback_dma_data = &drvdata->playback_dma_data;
+	capture_dma_data = &drvdata->capture_dma_data;
 
 	playback_dma_data->addr = drvdata->msp->tx_rx_addr;
 	capture_dma_data->addr = drvdata->msp->tx_rx_addr;
diff --git a/sound/soc/ux500/ux500_msp_dai.h b/sound/soc/ux500/ux500_msp_dai.h
index 7e63e8c0b5b4..d5d9ec6b120f 100644
--- a/sound/soc/ux500/ux500_msp_dai.h
+++ b/sound/soc/ux500/ux500_msp_dai.h
@@ -13,6 +13,8 @@
 #include <linux/types.h>
 #include <linux/spinlock.h>
 
+#include <sound/dmaengine_pcm.h>
+
 #include "ux500_msp_i2s.h"
 
 #define UX500_NBR_OF_DAI	4
@@ -40,6 +42,8 @@ struct ux500_msp_i2s_drvdata {
 	unsigned int rx_mask;
 	int slots;
 	int slot_width;
+	struct snd_dmaengine_dai_dma_data playback_dma_data;
+	struct snd_dmaengine_dai_dma_data capture_dma_data;
 
 	/* Clocks */
 	unsigned int master_clk;

-- 
Git-157)





More information about the linux-arm-kernel mailing list