Skip to content

Commit eec9169

Browse files
JiangJiasgregkh
authored andcommitted
uio: uio_dmem_genirq: Catch the Exception
The return value of dma_set_coherent_mask() is not always 0. To catch the exception in case that dma is not support the mask. Fixes: 0a0c3b5 ("Add new uio device for dynamic memory allocation") Signed-off-by: Jiasheng Jiang <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 70602b3 commit eec9169

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

drivers/uio/uio_dmem_genirq.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,11 @@ static int uio_dmem_genirq_probe(struct platform_device *pdev)
188188
return -ENOMEM;
189189
}
190190

191-
dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32));
191+
ret = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32));
192+
if (ret) {
193+
dev_err(&pdev->dev, "DMA enable failed\n");
194+
return ret;
195+
}
192196

193197
priv->uioinfo = uioinfo;
194198
spin_lock_init(&priv->lock);

0 commit comments

Comments
 (0)