提交 2550bbfd 编写于 作者: C Christoph Hellwig

dma-direct: don't crash on device without dma_mask

Print a useful warning instead.
Reported-by: NFinn Thain <fthain@telegraphics.com.au>
Tested-by: NFinn Thain <fthain@telegraphics.com.au>
Signed-off-by: NChristoph Hellwig <hch@lst.de>
上级 267d2e18
......@@ -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",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册