dmaengine Archive mirror
 help / color / mirror / Atom feed
From: Eric Debief <debief@digigram.com>
To: dmaengine@vger.kernel.org
Subject: Fwd: [PATCH] dmaengine, xdma.c : NULL pointer check instead of IS_ERR() on devm_regmap_init_mmio() call
Date: Mon, 29 Apr 2024 15:06:41 +0200	[thread overview]
Message-ID: <CALYqZ9kpENdyJWMbj7+ASVcEy_-LmO-uGw58eUsmi4eEQa7KNA@mail.gmail.com> (raw)
In-Reply-To: <CALYqZ9k4MOLp7_0fKPSc--DyBjSCX_DGTvAE9HhSu69C32iP9g@mail.gmail.com>

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 --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/>

           reply	other threads:[~2024-04-29 13:07 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <CALYqZ9k4MOLp7_0fKPSc--DyBjSCX_DGTvAE9HhSu69C32iP9g@mail.gmail.com>]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CALYqZ9kpENdyJWMbj7+ASVcEy_-LmO-uGw58eUsmi4eEQa7KNA@mail.gmail.com \
    --to=debief@digigram.com \
    --cc=dmaengine@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).