diff options
Diffstat (limited to 'sound/pci/trident/trident_memory.c')
-rw-r--r-- | sound/pci/trident/trident_memory.c | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/sound/pci/trident/trident_memory.c b/sound/pci/trident/trident_memory.c index 2fe3b1fab53a..f9779e23fe57 100644 --- a/sound/pci/trident/trident_memory.c +++ b/sound/pci/trident/trident_memory.c | |||
@@ -194,7 +194,6 @@ snd_trident_alloc_sg_pages(struct snd_trident *trident, | |||
194 | struct snd_util_memblk *blk; | 194 | struct snd_util_memblk *blk; |
195 | struct snd_pcm_runtime *runtime = substream->runtime; | 195 | struct snd_pcm_runtime *runtime = substream->runtime; |
196 | int idx, page; | 196 | int idx, page; |
197 | struct snd_sg_buf *sgbuf = snd_pcm_substream_sgbuf(substream); | ||
198 | 197 | ||
199 | if (snd_BUG_ON(runtime->dma_bytes <= 0 || | 198 | if (snd_BUG_ON(runtime->dma_bytes <= 0 || |
200 | runtime->dma_bytes > SNDRV_TRIDENT_MAX_PAGES * | 199 | runtime->dma_bytes > SNDRV_TRIDENT_MAX_PAGES * |
@@ -212,18 +211,14 @@ snd_trident_alloc_sg_pages(struct snd_trident *trident, | |||
212 | mutex_unlock(&hdr->block_mutex); | 211 | mutex_unlock(&hdr->block_mutex); |
213 | return NULL; | 212 | return NULL; |
214 | } | 213 | } |
215 | if (lastpg(blk) - firstpg(blk) >= sgbuf->pages) { | ||
216 | snd_printk(KERN_ERR "page calculation doesn't match: allocated pages = %d, trident = %d/%d\n", sgbuf->pages, firstpg(blk), lastpg(blk)); | ||
217 | __snd_util_mem_free(hdr, blk); | ||
218 | mutex_unlock(&hdr->block_mutex); | ||
219 | return NULL; | ||
220 | } | ||
221 | 214 | ||
222 | /* set TLB entries */ | 215 | /* set TLB entries */ |
223 | idx = 0; | 216 | idx = 0; |
224 | for (page = firstpg(blk); page <= lastpg(blk); page++, idx++) { | 217 | for (page = firstpg(blk); page <= lastpg(blk); page++, idx++) { |
225 | dma_addr_t addr = sgbuf->table[idx].addr; | 218 | unsigned long ofs = idx << PAGE_SHIFT; |
226 | unsigned long ptr = (unsigned long)sgbuf->table[idx].buf; | 219 | dma_addr_t addr = snd_pcm_sgbuf_get_addr(substream, ofs); |
220 | unsigned long ptr = (unsigned long) | ||
221 | snd_pcm_sgbuf_get_ptr(substream, ofs); | ||
227 | if (! is_valid_page(addr)) { | 222 | if (! is_valid_page(addr)) { |
228 | __snd_util_mem_free(hdr, blk); | 223 | __snd_util_mem_free(hdr, blk); |
229 | mutex_unlock(&hdr->block_mutex); | 224 | mutex_unlock(&hdr->block_mutex); |