diff mbox

[RESEND,0/2] : dmaengine, xdma.c : NULL pointer check instead of IS_ERR() on devm_regmap_init_mmio() call

Message ID CALYqZ9=pVRtSY=w4hG0R3HEM_Y=bpLba2_jRcvcZX4eLX5Yw-A@mail.gmail.com (mailing list archive)
State Changes Requested
Headers show

Commit Message

Eric Debief May 22, 2024, 12:12 p.m. UTC
Hi,

Reading xdma.c, I've found that the error check of
devm_regmap_init_mmio() is based on NULL pointer, but this function
uses the IS_ERR() mechanism.
I hope this helps.
Eric.

Here is my patch (I hope corrected) :

From 14fbbcb3425a5d0ee5e9ae92aef6f7ae4d1e3c8d Mon Sep 17 00:00:00 2001
From: Eric DEBIEF <debief@digigram.com>
Date: Wed, 22 May 2024 11:54:54 +0200
Subject: FIX: devm_regmap_init_mmio() error is not a NULL pointer.

    This function returns an error code which
    must be checked with the IS_ERR() macro.


Signed-off-by: Eric DEBIEF <debief@digigram.com>
---
 drivers/dma/xilinx/xdma.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--
2.34.1
diff mbox

Patch

diff --git a/drivers/dma/xilinx/xdma.c b/drivers/dma/xilinx/xdma.c
index 313b217388fe..74d4a953b50f 100644
--- a/drivers/dma/xilinx/xdma.c
+++ b/drivers/dma/xilinx/xdma.c
@@ -1240,7 +1240,8 @@  static int xdma_probe(struct platform_device *pdev)

     xdev->rmap = devm_regmap_init_mmio(&pdev->dev, reg_base,
                        &xdma_regmap_config);
-    if (!xdev->rmap) {
+    if (IS_ERR(xdev->rmap)) {
+        ret = PTR_ERR(xdev->rmap);
         xdma_err(xdev, "config regmap failed: %d", ret);
         goto failed;
     }