dma-direct: don't crash on device without dma_mask
Print a useful warning instead. Reported-by: Finn Thain <fthain@telegraphics.com.au> Tested-by: Finn Thain <fthain@telegraphics.com.au> Signed-off-by: Christoph Hellwig <hch@lst.de>
This commit is contained in:
parent
267d2e18a2
commit
2550bbfd49
@ -34,6 +34,13 @@ check_addr(struct device *dev, dma_addr_t dma_addr, size_t size,
|
||||
const char *caller)
|
||||
{
|
||||
if (unlikely(dev && !dma_capable(dev, dma_addr, size))) {
|
||||
if (!dev->dma_mask) {
|
||||
dev_err(dev,
|
||||
"%s: call on device without dma_mask\n",
|
||||
caller);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (*dev->dma_mask >= DMA_BIT_MASK(32)) {
|
||||
dev_err(dev,
|
||||
"%s: overflow %pad+%zu of device mask %llx\n",
|
||||
|
Loading…
Reference in New Issue
Block a user