Skip to content

Commit abe01a7

Browse files
TE-N-ShengjiuWangbroonie
authored andcommitted
ASoC: fsl_asrc_m2m: return error value in asrc_m2m_device_run()
The asrc_m2m_device_run() function is the main process function of converting, the error need to be returned to user, that user can handle error case properly. Fixes: 24a0171 ("ASoC: fsl_asrc_m2m: Add memory to memory function") Signed-off-by: Shengjiu Wang <[email protected]> Reviewed-by: Daniel Baluta <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent d12ca6d commit abe01a7

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

sound/soc/fsl/fsl_asrc_m2m.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ static int asrc_dmaconfig(struct fsl_asrc_pair *pair,
183183
}
184184

185185
/* main function of converter */
186-
static void asrc_m2m_device_run(struct fsl_asrc_pair *pair, struct snd_compr_task_runtime *task)
186+
static int asrc_m2m_device_run(struct fsl_asrc_pair *pair, struct snd_compr_task_runtime *task)
187187
{
188188
struct fsl_asrc *asrc = pair->asrc;
189189
struct device *dev = &asrc->pdev->dev;
@@ -193,7 +193,7 @@ static void asrc_m2m_device_run(struct fsl_asrc_pair *pair, struct snd_compr_tas
193193
unsigned int out_dma_len;
194194
unsigned int width;
195195
u32 fifo_addr;
196-
int ret;
196+
int ret = 0;
197197

198198
/* set ratio mod */
199199
if (asrc->m2m_set_ratio_mod) {
@@ -215,6 +215,7 @@ static void asrc_m2m_device_run(struct fsl_asrc_pair *pair, struct snd_compr_tas
215215
in_buf_len > ASRC_M2M_BUFFER_SIZE ||
216216
in_buf_len % (width * pair->channels / 8)) {
217217
dev_err(dev, "out buffer size is error: [%d]\n", in_buf_len);
218+
ret = -EINVAL;
218219
goto end;
219220
}
220221

@@ -245,6 +246,7 @@ static void asrc_m2m_device_run(struct fsl_asrc_pair *pair, struct snd_compr_tas
245246
}
246247
} else if (out_dma_len > ASRC_M2M_BUFFER_SIZE) {
247248
dev_err(dev, "cap buffer size error\n");
249+
ret = -EINVAL;
248250
goto end;
249251
}
250252

@@ -263,12 +265,14 @@ static void asrc_m2m_device_run(struct fsl_asrc_pair *pair, struct snd_compr_tas
263265

264266
if (!wait_for_completion_interruptible_timeout(&pair->complete[IN], 10 * HZ)) {
265267
dev_err(dev, "out DMA task timeout\n");
268+
ret = -ETIMEDOUT;
266269
goto end;
267270
}
268271

269272
if (out_dma_len > 0) {
270273
if (!wait_for_completion_interruptible_timeout(&pair->complete[OUT], 10 * HZ)) {
271274
dev_err(dev, "cap DMA task timeout\n");
275+
ret = -ETIMEDOUT;
272276
goto end;
273277
}
274278
}
@@ -278,7 +282,7 @@ static void asrc_m2m_device_run(struct fsl_asrc_pair *pair, struct snd_compr_tas
278282
/* update payload length for capture */
279283
task->output_size = out_dma_len;
280284
end:
281-
return;
285+
return ret;
282286
}
283287

284288
static int fsl_asrc_m2m_comp_open(struct snd_compr_stream *stream)
@@ -525,9 +529,7 @@ static int fsl_asrc_m2m_comp_task_start(struct snd_compr_stream *stream,
525529
struct snd_compr_runtime *runtime = stream->runtime;
526530
struct fsl_asrc_pair *pair = runtime->private_data;
527531

528-
asrc_m2m_device_run(pair, task);
529-
530-
return 0;
532+
return asrc_m2m_device_run(pair, task);
531533
}
532534

533535
static int fsl_asrc_m2m_comp_task_stop(struct snd_compr_stream *stream,

0 commit comments

Comments
 (0)