[PATCH v2 10/10] dmaengine: imx-sdma: make use of dev_err_probe()

Marco Felsch
2025-09-11T21:59:50Z

Add dev_err_probe() at return path of probe() to support users to
identify issues easier.

Reviewed-by: Frank Li <Frank.Li@nxp.com>
Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
---
drivers/dma/imx-sdma.c | 41 +++++++++++++++++------------------------
1 file changed, 17 insertions(+), 24 deletions(-)

diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c
index a7e6554ca223e2e980caf2e2dea832db9ad60ed6..d4430e6e56deda7de3538e42af7987a456957b43 100644
--- a/drivers/dma/imx-sdma.c
+++ b/drivers/dma/imx-sdma.c
@@ -2292,7 +2292,7 @@ static int sdma_probe(struct platform_device *pdev)

ret = dma_coerce_mask_and_coherent(dev, DMA_BIT_MASK(32));
if (ret)
- return ret;
+ return dev_err_probe(dev, ret, "Failed to set DMA mask\n");

sdma = devm_kzalloc(dev, sizeof(*sdma), GFP_KERNEL);
if (!sdma)
@@ -2309,24 +2309,24 @@ static int sdma_probe(struct platform_device *pdev)

irq = platform_get_irq(pdev, 0);
if (irq < 0)
- return irq;
+ return dev_err_probe(dev, irq, "Failed to get IRQ\n");

sdma->regs = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(sdma->regs))
- return PTR_ERR(sdma->regs);
+ return dev_err_probe(dev, PTR_ERR(sdma->regs), "ioremap failed\n");

sdma->clk_ipg = devm_clk_get_prepared(dev, "ipg");
if (IS_ERR(sdma->clk_ipg))
- return PTR_ERR(sdma->clk_ipg);
+ return dev_err_probe(dev, PTR_ERR(sdma->clk_ipg), "IPG clk_get_prepared failed\n");

sdma->clk_ahb = devm_clk_get_prepared(dev, "ahb");
if (IS_ERR(sdma->clk_ahb))
- return PTR_ERR(sdma->clk_ahb);
+ return dev_err_probe(dev, PTR_ERR(sdma->clk_ahb), "AHB clk_get_prepared failed\n");

ret = devm_request_irq(dev, irq, sdma_int_handler, 0,
dev_name(dev), sdma);
if (ret)
- return ret;
+ return dev_err_probe(dev, ret, "Failed to request IRQ\n");

sdma->irq = irq;

@@ -2367,11 +2367,11 @@ static int sdma_probe(struct platform_device *pdev)

ret = sdma_init(sdma);
if (ret)
- return ret;
+ return dev_err_probe(dev, ret, "sdma_init failed\n");

ret = sdma_event_remap(sdma);
if (ret)
- return ret;
+ return dev_err_probe(dev, ret, "sdma_event_remap failed\n");

if (sdma->drvdata->script_addrs)
sdma_add_scripts(sdma, sdma->drvdata->script_addrs);
@@ -2398,28 +2398,21 @@ static int sdma_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, sdma);

ret = dma_async_device_register(&sdma->dma_device);
- if (ret) {
- dev_err(dev, "unable to register\n");
- return ret;
- }
+ if (ret)
+ return dev_err_probe(dev, ret, "unable to register\n");

ret = devm_add_action_or_reset(dev, sdma_dma_device_unregister_action, sdma);
- if (ret) {
- dev_err(dev, "Unable to register release hook\n");
- return ret;
- }
+ if (ret)
+ return dev_err_probe(dev, ret, "Unable to register release hook\n");

ret = of_dma_controller_register(np, sdma_xlate, sdma);
- if (ret) {
- dev_err(dev, "failed to register controller\n");
- return ret;
- }
+ if (ret)
+ return dev_err_probe(dev, ret, "failed to register controller\n");

ret = devm_add_action_or_reset(dev, sdma_dma_of_dma_controller_unregister_action, sdma);
- if (ret) {
- dev_err(dev, "failed to register of-dma-controller unregister hook\n");
- return ret;
- }
+ if (ret)
+ return dev_err_probe(dev, ret,
+ "failed to register of-dma-controller unregister hook\n");

/*
* Because that device tree does not encode ROM script address,

--
2.47.3