summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Metcalf <cmetcalf@tilera.com>2013-08-05 12:37:24 -0400
committerChris Metcalf <cmetcalf@tilera.com>2013-08-06 12:55:36 -0400
commit9b6846cede40cf12429d0fa06b3af0a0f40ae596 (patch)
tree5855548ce4adfba321fa957d64b88f7230b9e3ec
parentcf89c4262bd5fa70e67953126001c08ecea4f346 (diff)
tile PCI DMA: handle a NULL dev argument properly
Signed-off-by: Chris Metcalf <cmetcalf@tilera.com>
-rw-r--r--arch/tile/kernel/pci-dma.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/arch/tile/kernel/pci-dma.c b/arch/tile/kernel/pci-dma.c
index 7e22e73264a9..adc369d8c77b 100644
--- a/arch/tile/kernel/pci-dma.c
+++ b/arch/tile/kernel/pci-dma.c
@@ -36,8 +36,9 @@ static void *tile_dma_alloc_coherent(struct device *dev, size_t size,
dma_addr_t *dma_handle, gfp_t gfp,
struct dma_attrs *attrs)
{
- u64 dma_mask = dev->coherent_dma_mask ?: DMA_BIT_MASK(32);
- int node = dev_to_node(dev);
+ u64 dma_mask = (dev && dev->coherent_dma_mask) ?
+ dev->coherent_dma_mask : DMA_BIT_MASK(32);
+ int node = dev ? dev_to_node(dev) : 0;
int order = get_order(size);
struct page *pg;
dma_addr_t addr;