[PATCH 30/33] dmaengine: at_hdmac: Check return code of dma_async_device_register

From: Tudor Ambarus
Date: Sat Aug 20 2022 - 09:01:12 EST


dma_async_device_register() can fail, check the return code and display an
error.

Signed-off-by: Tudor Ambarus <tudor.ambarus@xxxxxxxxxxxxx>
---
drivers/dma/at_hdmac.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
index 042c7cba74bb..0b473e6d161d 100644
--- a/drivers/dma/at_hdmac.c
+++ b/drivers/dma/at_hdmac.c
@@ -2353,7 +2353,11 @@ static int __init at_dma_probe(struct platform_device *pdev)
dma_has_cap(DMA_SLAVE, atdma->dma_device.cap_mask) ? "slave " : "",
plat_dat->nr_channels);

- dma_async_device_register(&atdma->dma_device);
+ err = dma_async_device_register(&atdma->dma_device);
+ if (err) {
+ dev_err(&pdev->dev, "Unable to register: %d.\n", err);
+ goto err_dma_async_device_register;
+ }

/*
* Do not return an error if the dmac node is not present in order to
@@ -2373,6 +2377,7 @@ static int __init at_dma_probe(struct platform_device *pdev)

err_of_dma_controller_register:
dma_async_device_unregister(&atdma->dma_device);
+err_dma_async_device_register:
dma_pool_destroy(atdma->memset_pool);
err_memset_pool_create:
dma_pool_destroy(atdma->dma_desc_pool);
--
2.25.1