[PATCH] ASoC: SOF: Fix probe point getter

Cezary Rojewski cezary.rojewski at intel.com
Mon Mar 9 15:21:24 CET 2020


Firmware API changes which introduced 'num_elems' param in several probe
structs such as sof_ipc_probe_dma_add_params also impacted getter for
both, DMA and probe points. All struct handlers except for
sof_ipc_probe_info_params have been updated. Align said handler too to
calculate payload size correctly.

Signed-off-by: Cezary Rojewski <cezary.rojewski at intel.com>
Fixes: f3b433e4699f ("ASoC: SOF: Implement Probe IPC API")
---
 sound/soc/sof/probe.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/sound/soc/sof/probe.c b/sound/soc/sof/probe.c
index 2b2f3dcfc7e9..c38169fe00c5 100644
--- a/sound/soc/sof/probe.c
+++ b/sound/soc/sof/probe.c
@@ -95,13 +95,17 @@ static int sof_ipc_probe_info(struct snd_sof_dev *sdev, unsigned int cmd,
 	if (!reply->num_elems)
 		goto exit;
 
-	bytes = reply->num_elems * sizeof(reply->dma[0]);
+	if (cmd == SOF_IPC_PROBE_DMA_INFO)
+		bytes = sizeof(reply->dma[0]);
+	else
+		bytes = sizeof(reply->desc[0]);
+	bytes *= reply->num_elems;
 	*params = kmemdup(&reply->dma[0], bytes, GFP_KERNEL);
 	if (!*params) {
 		ret = -ENOMEM;
 		goto exit;
 	}
-	*num_params = msg.num_elems;
+	*num_params = reply->num_elems;
 
 exit:
 	kfree(reply);
-- 
2.17.1



More information about the Alsa-devel mailing list