diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2008-10-23 05:42:03 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-10-23 15:54:38 -0400 |
commit | a2b89b596c5a0b288adac84b17bdda6bde8d144e (patch) | |
tree | cb33305ff4f30ceaba1c5cbd0eef84d68edca942 /lib/swiotlb.c | |
parent | ff3c536291ce96ef6f45704cd37eaed71127dd42 (diff) |
swiotlb: remove panic for alloc_coherent failure
swiotlb_alloc_coherent calls panic() when allocated swiotlb pages is
not fit for a device's dma mask. However, alloc_coherent failure is
not a disaster at all. AFAIK, none of other x86 and IA64 IOMMU
implementations don't crash in case of alloc_coherent failure.
There are some drivers that don't check alloc_coherent failure but not
many (about ten and I've already started to fix some of
them). alloc_coherent returns NULL in case of failure so it's likely
that these guilty drivers crash immediately. So swiotlb doesn't need
to call panic() just for them.
Reported-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Tested-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'lib/swiotlb.c')
-rw-r--r-- | lib/swiotlb.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/swiotlb.c b/lib/swiotlb.c index f8eebd489149..78330c37a61b 100644 --- a/lib/swiotlb.c +++ b/lib/swiotlb.c | |||
@@ -497,8 +497,10 @@ swiotlb_alloc_coherent(struct device *hwdev, size_t size, | |||
497 | printk("hwdev DMA mask = 0x%016Lx, dev_addr = 0x%016Lx\n", | 497 | printk("hwdev DMA mask = 0x%016Lx, dev_addr = 0x%016Lx\n", |
498 | (unsigned long long)*hwdev->dma_mask, | 498 | (unsigned long long)*hwdev->dma_mask, |
499 | (unsigned long long)dev_addr); | 499 | (unsigned long long)dev_addr); |
500 | panic("swiotlb_alloc_coherent: allocated memory is out of " | 500 | |
501 | "range for device"); | 501 | /* DMA_TO_DEVICE to avoid memcpy in unmap_single */ |
502 | unmap_single(hwdev, ret, size, DMA_TO_DEVICE); | ||
503 | return NULL; | ||
502 | } | 504 | } |
503 | *dma_handle = dev_addr; | 505 | *dma_handle = dev_addr; |
504 | return ret; | 506 | return ret; |