diff mbox series

mfd: omap-usb-host: Handle dma_set_coherent_mask error codes

Message ID 20211206021021.1616073-1-jiasheng@iscas.ac.cn (mailing list archive)
State New, archived
Headers show
Series mfd: omap-usb-host: Handle dma_set_coherent_mask error codes | expand

Commit Message

Jiasheng Jiang Dec. 6, 2021, 2:10 a.m. UTC
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: cbb8c220e70d ("mfd: Remove omap-usb-host magic numbers for dev dma mask")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
---
 drivers/mfd/omap-usb-host.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/drivers/mfd/omap-usb-host.c b/drivers/mfd/omap-usb-host.c
index 2a3a240b4619..05af9ad314b1 100644
--- a/drivers/mfd/omap-usb-host.c
+++ b/drivers/mfd/omap-usb-host.c
@@ -169,7 +169,11 @@  static struct platform_device *omap_usbhs_alloc_child(const char *name,
 	}
 
 	child->dev.dma_mask		= &usbhs_dmamask;
-	dma_set_coherent_mask(&child->dev, DMA_BIT_MASK(32));
+	ret = dma_set_coherent_mask(&child->dev, DMA_BIT_MASK(32));
+	if (ret) {
+		dev_err(&child->dev, "DMA enable failed\n");
+		goto err_alloc;
+	}
 	child->dev.parent		= dev;
 
 	ret = platform_device_add(child);