Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: 0a0c3b5a24bd ("Add new uio device for dynamic memory allocation")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
Link: https://lore.kernel.org/r/20211204000326.1592687-1-jiasheng@iscas.ac.cn
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Jiasheng Jiang and committed by
Greg Kroah-Hartman
eec91694 70602b37

+5 -1
+5 -1
drivers/uio/uio_dmem_genirq.c
··· 188 188 return -ENOMEM; 189 189 } 190 190 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 + } 192 196 193 197 priv->uioinfo = uioinfo; 194 198 spin_lock_init(&priv->lock);