diff options
-rw-r--r-- | sound/core/memalloc.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/sound/core/memalloc.c b/sound/core/memalloc.c index f0c3b1d6da81..a7b46ec72f32 100644 --- a/sound/core/memalloc.c +++ b/sound/core/memalloc.c | |||
@@ -277,11 +277,16 @@ int snd_dma_alloc_pages_fallback(int type, struct device *device, size_t size, | |||
277 | int err; | 277 | int err; |
278 | 278 | ||
279 | while ((err = snd_dma_alloc_pages(type, device, size, dmab)) < 0) { | 279 | while ((err = snd_dma_alloc_pages(type, device, size, dmab)) < 0) { |
280 | size_t aligned_size; | ||
280 | if (err != -ENOMEM) | 281 | if (err != -ENOMEM) |
281 | return err; | 282 | return err; |
282 | size >>= 1; | ||
283 | if (size <= PAGE_SIZE) | 283 | if (size <= PAGE_SIZE) |
284 | return -ENOMEM; | 284 | return -ENOMEM; |
285 | aligned_size = PAGE_SIZE << get_order(size); | ||
286 | if (size != aligned_size) | ||
287 | size = aligned_size; | ||
288 | else | ||
289 | size >>= 1; | ||
285 | } | 290 | } |
286 | if (! dmab->area) | 291 | if (! dmab->area) |
287 | return -ENOMEM; | 292 | return -ENOMEM; |