diff options
Diffstat (limited to 'sound/pci/echoaudio/echoaudio.c')
-rw-r--r-- | sound/pci/echoaudio/echoaudio.c | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/sound/pci/echoaudio/echoaudio.c b/sound/pci/echoaudio/echoaudio.c index e16dc92e82fb..8dbc5c4ba421 100644 --- a/sound/pci/echoaudio/echoaudio.c +++ b/sound/pci/echoaudio/echoaudio.c | |||
@@ -490,7 +490,6 @@ static int init_engine(struct snd_pcm_substream *substream, | |||
490 | { | 490 | { |
491 | struct echoaudio *chip; | 491 | struct echoaudio *chip; |
492 | int err, per, rest, page, edge, offs; | 492 | int err, per, rest, page, edge, offs; |
493 | struct snd_sg_buf *sgbuf; | ||
494 | struct audiopipe *pipe; | 493 | struct audiopipe *pipe; |
495 | 494 | ||
496 | chip = snd_pcm_substream_chip(substream); | 495 | chip = snd_pcm_substream_chip(substream); |
@@ -503,7 +502,7 @@ static int init_engine(struct snd_pcm_substream *substream, | |||
503 | if (pipe->index >= 0) { | 502 | if (pipe->index >= 0) { |
504 | DE_HWP(("hwp_ie free(%d)\n", pipe->index)); | 503 | DE_HWP(("hwp_ie free(%d)\n", pipe->index)); |
505 | err = free_pipes(chip, pipe); | 504 | err = free_pipes(chip, pipe); |
506 | snd_assert(!err); | 505 | snd_BUG_ON(err); |
507 | chip->substream[pipe->index] = NULL; | 506 | chip->substream[pipe->index] = NULL; |
508 | } | 507 | } |
509 | 508 | ||
@@ -531,10 +530,6 @@ static int init_engine(struct snd_pcm_substream *substream, | |||
531 | return err; | 530 | return err; |
532 | } | 531 | } |
533 | 532 | ||
534 | sgbuf = snd_pcm_substream_sgbuf(substream); | ||
535 | |||
536 | DE_HWP(("pcm_hw_params table size=%d pages=%d\n", | ||
537 | sgbuf->size, sgbuf->pages)); | ||
538 | sglist_init(chip, pipe); | 533 | sglist_init(chip, pipe); |
539 | edge = PAGE_SIZE; | 534 | edge = PAGE_SIZE; |
540 | for (offs = page = per = 0; offs < params_buffer_bytes(hw_params); | 535 | for (offs = page = per = 0; offs < params_buffer_bytes(hw_params); |
@@ -543,16 +538,15 @@ static int init_engine(struct snd_pcm_substream *substream, | |||
543 | if (offs + rest > params_buffer_bytes(hw_params)) | 538 | if (offs + rest > params_buffer_bytes(hw_params)) |
544 | rest = params_buffer_bytes(hw_params) - offs; | 539 | rest = params_buffer_bytes(hw_params) - offs; |
545 | while (rest) { | 540 | while (rest) { |
541 | dma_addr_t addr; | ||
542 | addr = snd_pcm_sgbuf_get_addr(substream, offs); | ||
546 | if (rest <= edge - offs) { | 543 | if (rest <= edge - offs) { |
547 | sglist_add_mapping(chip, pipe, | 544 | sglist_add_mapping(chip, pipe, addr, rest); |
548 | snd_sgbuf_get_addr(sgbuf, offs), | ||
549 | rest); | ||
550 | sglist_add_irq(chip, pipe); | 545 | sglist_add_irq(chip, pipe); |
551 | offs += rest; | 546 | offs += rest; |
552 | rest = 0; | 547 | rest = 0; |
553 | } else { | 548 | } else { |
554 | sglist_add_mapping(chip, pipe, | 549 | sglist_add_mapping(chip, pipe, addr, |
555 | snd_sgbuf_get_addr(sgbuf, offs), | ||
556 | edge - offs); | 550 | edge - offs); |
557 | rest -= edge - offs; | 551 | rest -= edge - offs; |
558 | offs = edge; | 552 | offs = edge; |
@@ -690,8 +684,10 @@ static int pcm_prepare(struct snd_pcm_substream *substream) | |||
690 | return -EINVAL; | 684 | return -EINVAL; |
691 | } | 685 | } |
692 | 686 | ||
693 | snd_assert(pipe_index < px_num(chip), return -EINVAL); | 687 | if (snd_BUG_ON(pipe_index >= px_num(chip))) |
694 | snd_assert(is_pipe_allocated(chip, pipe_index), return -EINVAL); | 688 | return -EINVAL; |
689 | if (snd_BUG_ON(!is_pipe_allocated(chip, pipe_index))) | ||
690 | return -EINVAL; | ||
695 | set_audio_format(chip, pipe_index, &format); | 691 | set_audio_format(chip, pipe_index, &format); |
696 | return 0; | 692 | return 0; |
697 | } | 693 | } |