diff mbox series

dmaengine, xdma.c : NULL pointer check instead of IS_ERR() on devm_regmap_init_mmio() call

Message ID CALYqZ9kpENdyJWMbj7+ASVcEy_-LmO-uGw58eUsmi4eEQa7KNA@mail.gmail.com (mailing list archive)
State Changes Requested
Headers show
Series dmaengine, xdma.c : NULL pointer check instead of IS_ERR() on devm_regmap_init_mmio() call | expand

Commit Message

Eric Debief April 29, 2024, 1:06 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.

Here is my patch :


From bee2a90fc1959682afa4ff1a90adbc2a18770abd Mon Sep 17 00:00:00 2001
From: Eric DEBIEF <debief@digigram.com>
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 mbox series

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