Use dmaenginem_async_device_register() to simplify the code.
Remove the code calling dma_async_device_unregister().

Signed-off-by: Huang Shijie <sjhu...@iluvatar.ai>
---
 drivers/dma/zx_dma.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/dma/zx_dma.c b/drivers/dma/zx_dma.c
index 2571bc7693df..7febd20113ef 100644
--- a/drivers/dma/zx_dma.c
+++ b/drivers/dma/zx_dma.c
@@ -861,20 +861,18 @@ static int zx_dma_probe(struct platform_device *op)
        INIT_LIST_HEAD(&d->chan_pending);
        platform_set_drvdata(op, d);
 
-       ret = dma_async_device_register(&d->slave);
+       ret = dmaenginem_async_device_register(&d->slave);
        if (ret)
                goto clk_dis;
 
        ret = of_dma_controller_register((&op->dev)->of_node,
                                         zx_of_dma_simple_xlate, d);
        if (ret)
-               goto of_dma_register_fail;
+               goto clk_dis;
 
        dev_info(&op->dev, "initialized\n");
        return 0;
 
-of_dma_register_fail:
-       dma_async_device_unregister(&d->slave);
 clk_dis:
        clk_disable_unprepare(d->clk);
 zx_dma_out:
@@ -889,7 +887,6 @@ static int zx_dma_remove(struct platform_device *op)
        /* explictly free the irq */
        devm_free_irq(&op->dev, d->irq, d);
 
-       dma_async_device_unregister(&d->slave);
        of_dma_controller_free((&op->dev)->of_node);
 
        list_for_each_entry_safe(c, cn, &d->slave.channels,
-- 
2.17.1

Reply via email to