diff options
Diffstat (limited to 'include/linux/dma-mapping.h')
| -rw-r--r-- | include/linux/dma-mapping.h | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h index f9cc309507d9..1db6a6b46d0d 100644 --- a/include/linux/dma-mapping.h +++ b/include/linux/dma-mapping.h | |||
| @@ -538,10 +538,17 @@ static inline void dma_free_attrs(struct device *dev, size_t size, | |||
| 538 | const struct dma_map_ops *ops = get_dma_ops(dev); | 538 | const struct dma_map_ops *ops = get_dma_ops(dev); |
| 539 | 539 | ||
| 540 | BUG_ON(!ops); | 540 | BUG_ON(!ops); |
| 541 | WARN_ON(irqs_disabled()); | ||
| 542 | 541 | ||
| 543 | if (dma_release_from_dev_coherent(dev, get_order(size), cpu_addr)) | 542 | if (dma_release_from_dev_coherent(dev, get_order(size), cpu_addr)) |
| 544 | return; | 543 | return; |
| 544 | /* | ||
| 545 | * On non-coherent platforms which implement DMA-coherent buffers via | ||
| 546 | * non-cacheable remaps, ops->free() may call vunmap(). Thus getting | ||
| 547 | * this far in IRQ context is a) at risk of a BUG_ON() or trying to | ||
| 548 | * sleep on some machines, and b) an indication that the driver is | ||
| 549 | * probably misusing the coherent API anyway. | ||
| 550 | */ | ||
| 551 | WARN_ON(irqs_disabled()); | ||
| 545 | 552 | ||
| 546 | if (!ops->free || !cpu_addr) | 553 | if (!ops->free || !cpu_addr) |
| 547 | return; | 554 | return; |
