aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/nm256
diff options
context:
space:
mode:
Diffstat (limited to 'sound/pci/nm256')
-rw-r--r--sound/pci/nm256/nm256.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/sound/pci/nm256/nm256.c b/sound/pci/nm256/nm256.c
index 06d13e717114..50c9f8a05082 100644
--- a/sound/pci/nm256/nm256.c
+++ b/sound/pci/nm256/nm256.c
@@ -562,7 +562,8 @@ snd_nm256_playback_trigger(struct snd_pcm_substream *substream, int cmd)
562 struct nm256_stream *s = substream->runtime->private_data; 562 struct nm256_stream *s = substream->runtime->private_data;
563 int err = 0; 563 int err = 0;
564 564
565 snd_assert(s != NULL, return -ENXIO); 565 if (snd_BUG_ON(!s))
566 return -ENXIO;
566 567
567 spin_lock(&chip->reg_lock); 568 spin_lock(&chip->reg_lock);
568 switch (cmd) { 569 switch (cmd) {
@@ -599,7 +600,8 @@ snd_nm256_capture_trigger(struct snd_pcm_substream *substream, int cmd)
599 struct nm256_stream *s = substream->runtime->private_data; 600 struct nm256_stream *s = substream->runtime->private_data;
600 int err = 0; 601 int err = 0;
601 602
602 snd_assert(s != NULL, return -ENXIO); 603 if (snd_BUG_ON(!s))
604 return -ENXIO;
603 605
604 spin_lock(&chip->reg_lock); 606 spin_lock(&chip->reg_lock);
605 switch (cmd) { 607 switch (cmd) {
@@ -635,7 +637,8 @@ static int snd_nm256_pcm_prepare(struct snd_pcm_substream *substream)
635 struct snd_pcm_runtime *runtime = substream->runtime; 637 struct snd_pcm_runtime *runtime = substream->runtime;
636 struct nm256_stream *s = runtime->private_data; 638 struct nm256_stream *s = runtime->private_data;
637 639
638 snd_assert(s, return -ENXIO); 640 if (snd_BUG_ON(!s))
641 return -ENXIO;
639 s->dma_size = frames_to_bytes(runtime, substream->runtime->buffer_size); 642 s->dma_size = frames_to_bytes(runtime, substream->runtime->buffer_size);
640 s->period_size = frames_to_bytes(runtime, substream->runtime->period_size); 643 s->period_size = frames_to_bytes(runtime, substream->runtime->period_size);
641 s->periods = substream->runtime->periods; 644 s->periods = substream->runtime->periods;
@@ -660,7 +663,8 @@ snd_nm256_playback_pointer(struct snd_pcm_substream *substream)
660 struct nm256_stream *s = substream->runtime->private_data; 663 struct nm256_stream *s = substream->runtime->private_data;
661 unsigned long curp; 664 unsigned long curp;
662 665
663 snd_assert(s, return 0); 666 if (snd_BUG_ON(!s))
667 return 0;
664 curp = snd_nm256_readl(chip, NM_PBUFFER_CURRP) - (unsigned long)s->buf; 668 curp = snd_nm256_readl(chip, NM_PBUFFER_CURRP) - (unsigned long)s->buf;
665 curp %= s->dma_size; 669 curp %= s->dma_size;
666 return bytes_to_frames(substream->runtime, curp); 670 return bytes_to_frames(substream->runtime, curp);
@@ -673,7 +677,8 @@ snd_nm256_capture_pointer(struct snd_pcm_substream *substream)
673 struct nm256_stream *s = substream->runtime->private_data; 677 struct nm256_stream *s = substream->runtime->private_data;
674 unsigned long curp; 678 unsigned long curp;
675 679
676 snd_assert(s != NULL, return 0); 680 if (snd_BUG_ON(!s))
681 return 0;
677 curp = snd_nm256_readl(chip, NM_RBUFFER_CURRP) - (unsigned long)s->buf; 682 curp = snd_nm256_readl(chip, NM_RBUFFER_CURRP) - (unsigned long)s->buf;
678 curp %= s->dma_size; 683 curp %= s->dma_size;
679 return bytes_to_frames(substream->runtime, curp); 684 return bytes_to_frames(substream->runtime, curp);