diff options
Diffstat (limited to 'sound/pci/trident/trident_memory.c')
-rw-r--r-- | sound/pci/trident/trident_memory.c | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/sound/pci/trident/trident_memory.c b/sound/pci/trident/trident_memory.c index 3fd7f1b29b0f..2fe3b1fab53a 100644 --- a/sound/pci/trident/trident_memory.c +++ b/sound/pci/trident/trident_memory.c | |||
@@ -196,9 +196,13 @@ snd_trident_alloc_sg_pages(struct snd_trident *trident, | |||
196 | int idx, page; | 196 | int idx, page; |
197 | struct snd_sg_buf *sgbuf = snd_pcm_substream_sgbuf(substream); | 197 | struct snd_sg_buf *sgbuf = snd_pcm_substream_sgbuf(substream); |
198 | 198 | ||
199 | snd_assert(runtime->dma_bytes > 0 && runtime->dma_bytes <= SNDRV_TRIDENT_MAX_PAGES * SNDRV_TRIDENT_PAGE_SIZE, return NULL); | 199 | if (snd_BUG_ON(runtime->dma_bytes <= 0 || |
200 | runtime->dma_bytes > SNDRV_TRIDENT_MAX_PAGES * | ||
201 | SNDRV_TRIDENT_PAGE_SIZE)) | ||
202 | return NULL; | ||
200 | hdr = trident->tlb.memhdr; | 203 | hdr = trident->tlb.memhdr; |
201 | snd_assert(hdr != NULL, return NULL); | 204 | if (snd_BUG_ON(!hdr)) |
205 | return NULL; | ||
202 | 206 | ||
203 | 207 | ||
204 | 208 | ||
@@ -245,9 +249,13 @@ snd_trident_alloc_cont_pages(struct snd_trident *trident, | |||
245 | dma_addr_t addr; | 249 | dma_addr_t addr; |
246 | unsigned long ptr; | 250 | unsigned long ptr; |
247 | 251 | ||
248 | snd_assert(runtime->dma_bytes> 0 && runtime->dma_bytes <= SNDRV_TRIDENT_MAX_PAGES * SNDRV_TRIDENT_PAGE_SIZE, return NULL); | 252 | if (snd_BUG_ON(runtime->dma_bytes <= 0 || |
253 | runtime->dma_bytes > SNDRV_TRIDENT_MAX_PAGES * | ||
254 | SNDRV_TRIDENT_PAGE_SIZE)) | ||
255 | return NULL; | ||
249 | hdr = trident->tlb.memhdr; | 256 | hdr = trident->tlb.memhdr; |
250 | snd_assert(hdr != NULL, return NULL); | 257 | if (snd_BUG_ON(!hdr)) |
258 | return NULL; | ||
251 | 259 | ||
252 | mutex_lock(&hdr->block_mutex); | 260 | mutex_lock(&hdr->block_mutex); |
253 | blk = search_empty(hdr, runtime->dma_bytes); | 261 | blk = search_empty(hdr, runtime->dma_bytes); |
@@ -279,8 +287,8 @@ struct snd_util_memblk * | |||
279 | snd_trident_alloc_pages(struct snd_trident *trident, | 287 | snd_trident_alloc_pages(struct snd_trident *trident, |
280 | struct snd_pcm_substream *substream) | 288 | struct snd_pcm_substream *substream) |
281 | { | 289 | { |
282 | snd_assert(trident != NULL, return NULL); | 290 | if (snd_BUG_ON(!trident || !substream)) |
283 | snd_assert(substream != NULL, return NULL); | 291 | return NULL; |
284 | if (substream->dma_buffer.dev.type == SNDRV_DMA_TYPE_DEV_SG) | 292 | if (substream->dma_buffer.dev.type == SNDRV_DMA_TYPE_DEV_SG) |
285 | return snd_trident_alloc_sg_pages(trident, substream); | 293 | return snd_trident_alloc_sg_pages(trident, substream); |
286 | else | 294 | else |
@@ -297,8 +305,8 @@ int snd_trident_free_pages(struct snd_trident *trident, | |||
297 | struct snd_util_memhdr *hdr; | 305 | struct snd_util_memhdr *hdr; |
298 | int page; | 306 | int page; |
299 | 307 | ||
300 | snd_assert(trident != NULL, return -EINVAL); | 308 | if (snd_BUG_ON(!trident || !blk)) |
301 | snd_assert(blk != NULL, return -EINVAL); | 309 | return -EINVAL; |
302 | 310 | ||
303 | hdr = trident->tlb.memhdr; | 311 | hdr = trident->tlb.memhdr; |
304 | mutex_lock(&hdr->block_mutex); | 312 | mutex_lock(&hdr->block_mutex); |