@@ -183,7 +183,7 @@ static int asrc_dmaconfig(struct fsl_asrc_pair *pair,
183
183
}
184
184
185
185
/* 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 )
187
187
{
188
188
struct fsl_asrc * asrc = pair -> asrc ;
189
189
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
193
193
unsigned int out_dma_len ;
194
194
unsigned int width ;
195
195
u32 fifo_addr ;
196
- int ret ;
196
+ int ret = 0 ;
197
197
198
198
/* set ratio mod */
199
199
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
215
215
in_buf_len > ASRC_M2M_BUFFER_SIZE ||
216
216
in_buf_len % (width * pair -> channels / 8 )) {
217
217
dev_err (dev , "out buffer size is error: [%d]\n" , in_buf_len );
218
+ ret = - EINVAL ;
218
219
goto end ;
219
220
}
220
221
@@ -245,6 +246,7 @@ static void asrc_m2m_device_run(struct fsl_asrc_pair *pair, struct snd_compr_tas
245
246
}
246
247
} else if (out_dma_len > ASRC_M2M_BUFFER_SIZE ) {
247
248
dev_err (dev , "cap buffer size error\n" );
249
+ ret = - EINVAL ;
248
250
goto end ;
249
251
}
250
252
@@ -263,12 +265,14 @@ static void asrc_m2m_device_run(struct fsl_asrc_pair *pair, struct snd_compr_tas
263
265
264
266
if (!wait_for_completion_interruptible_timeout (& pair -> complete [IN ], 10 * HZ )) {
265
267
dev_err (dev , "out DMA task timeout\n" );
268
+ ret = - ETIMEDOUT ;
266
269
goto end ;
267
270
}
268
271
269
272
if (out_dma_len > 0 ) {
270
273
if (!wait_for_completion_interruptible_timeout (& pair -> complete [OUT ], 10 * HZ )) {
271
274
dev_err (dev , "cap DMA task timeout\n" );
275
+ ret = - ETIMEDOUT ;
272
276
goto end ;
273
277
}
274
278
}
@@ -278,7 +282,7 @@ static void asrc_m2m_device_run(struct fsl_asrc_pair *pair, struct snd_compr_tas
278
282
/* update payload length for capture */
279
283
task -> output_size = out_dma_len ;
280
284
end :
281
- return ;
285
+ return ret ;
282
286
}
283
287
284
288
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,
525
529
struct snd_compr_runtime * runtime = stream -> runtime ;
526
530
struct fsl_asrc_pair * pair = runtime -> private_data ;
527
531
528
- asrc_m2m_device_run (pair , task );
529
-
530
- return 0 ;
532
+ return asrc_m2m_device_run (pair , task );
531
533
}
532
534
533
535
static int fsl_asrc_m2m_comp_task_stop (struct snd_compr_stream * stream ,
@@ -633,7 +635,7 @@ int fsl_asrc_m2m_suspend(struct fsl_asrc *asrc)
633
635
634
636
for (i = 0 ; i < PAIR_CTX_NUM ; i ++ ) {
635
637
pair = asrc -> pair [i ];
636
- if (!pair )
638
+ if (!pair || ! pair -> dma_buffer [ IN ]. area || ! pair -> dma_buffer [ OUT ]. area )
637
639
continue ;
638
640
if (!completion_done (& pair -> complete [IN ])) {
639
641
if (pair -> dma_chan [IN ])
0 commit comments