Make the dma_alloc_coherent() function in the LinuxKPI NULL safe with regard

to the "dev" argument.

Submitted by:	Krishnamraju Eraparaju @ Chelsio
Sponsored by:	Chelsio Communications
MFC after:	1 week
This commit is contained in:
Hans Petter Selasky 2017-11-08 08:37:05 +00:00
parent fc5ef1ca4f
commit a7a3d0d170

View File

@ -127,7 +127,7 @@ dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle,
size_t align;
void *mem;
if (dev->dma_mask)
if (dev != NULL && dev->dma_mask)
high = *dev->dma_mask;
else if (flag & GFP_DMA32)
high = BUS_SPACE_MAXADDR_32BIT;