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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxx>
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@xxxxxxxxxxxx>
---
 drivers/dma/xilinx/xdma.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

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;
     }
--
2.34.1




[Index of Archives]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux PCI]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux