summaryrefslogtreecommitdiffstats
path: root/arch/mips/loongson64/common/dma-swiotlb.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/mips/loongson64/common/dma-swiotlb.c')
-rw-r--r--arch/mips/loongson64/common/dma-swiotlb.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/arch/mips/loongson64/common/dma-swiotlb.c b/arch/mips/loongson64/common/dma-swiotlb.c
index ef9da3b5c543..4ffa6fc81c8f 100644
--- a/arch/mips/loongson64/common/dma-swiotlb.c
+++ b/arch/mips/loongson64/common/dma-swiotlb.c
@@ -85,6 +85,9 @@ static void loongson_dma_sync_sg_for_device(struct device *dev,
static int loongson_dma_set_mask(struct device *dev, u64 mask)
{
+ if (!dev->dma_mask || !dma_supported(dev, mask))
+ return -EIO;
+
if (mask > DMA_BIT_MASK(loongson_sysconf.dma_mask_bits)) {
*dev->dma_mask = DMA_BIT_MASK(loongson_sysconf.dma_mask_bits);
return -EIO;