From: Yue Haibing <yuehaibing@huawei.com>
To: <lizhi.hou@amd.com>, <brian.xu@amd.com>,
<raj.kumar.rampelli@amd.com>, <vkoul@kernel.org>,
<michal.simek@amd.com>, <sonal.santan@amd.com>,
<max.zhen@amd.com>
Cc: <dmaengine@vger.kernel.org>,
<linux-arm-kernel@lists.infradead.org>,
<linux-kernel@vger.kernel.org>, <yuehaibing@huawei.com>
Subject: [PATCH -next] dmaengine: xilinx: xdma: Fix NULL vs IS_ERR() bug
Date: Tue, 20 Aug 2024 21:28:27 +0800 [thread overview]
Message-ID: <20240820132827.52108-1-yuehaibing@huawei.com> (raw)
devm_regmap_init_mmio() never returns NULL pointer, it will
return ERR_PTR() when it fails, so check it with IS_ERR().
Fixes: 17ce252266c7 ("dmaengine: xilinx: xdma: Add xilinx xdma driver")
Signed-off-by: Yue Haibing <yuehaibing@huawei.com>
---
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 718842fdaf98..44fae351f0a0 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
next reply other threads:[~2024-08-20 13:31 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-20 13:28 Yue Haibing [this message]
2024-08-20 15:29 ` Lizhi Hou
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=20240820132827.52108-1-yuehaibing@huawei.com \
--to=yuehaibing@huawei.com \
--cc=brian.xu@amd.com \
--cc=dmaengine@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lizhi.hou@amd.com \
--cc=max.zhen@amd.com \
--cc=michal.simek@amd.com \
--cc=raj.kumar.rampelli@amd.com \
--cc=sonal.santan@amd.com \
--cc=vkoul@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
all inboxes | Powered by JetHome®