Fwd: [PATCH] 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.

Here is my patch :


>From bee2a90fc1959682afa4ff1a90adbc2a18770abd Mon Sep 17 00:00:00 2001
From: Eric DEBIEF <debief@xxxxxxxxxxxx>
Date: Mon, 29 Apr 2024 14:55:31 +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.
---
 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


Hope this help,
Eric.

-- 
 
<https://www.digigram.com/digigram-critical-audio-at-critical-communications-world/>




[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