From: Dan Carpenter <dan.carpenter@oracle.com>
To: Kishon Vijay Abraham I <kishon@ti.com>,
Frank Li <Frank.Li@nxp.com>,
dmaengine@vger.kernel.org
Cc: "Lorenzo Pieralisi" <lpieralisi@kernel.org>,
"Krzysztof Wilczyński" <kw@linux.com>,
"Bjorn Helgaas" <bhelgaas@google.com>,
"Shunsuke Mie" <mie@igel.co.jp>,
"Hou Zhiqiang" <Zhiqiang.Hou@nxp.com>,
"Li Chen" <lchen@ambarella.com>,
"Manivannan Sadhasivam" <mani@kernel.org>,
linux-pci@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [PATCH] PCI: endpoint: IS_ERR() vs NULL bug in pci_epf_test_init_dma_chan()
Date: Fri, 8 Jul 2022 11:41:37 +0300 [thread overview]
Message-ID: <YsftwaVowtU9/pgn@kili> (raw)
The dma_request_channel() function doesn't return error pointers, it
returns NULL.
Fixes: fff86dfbbf82 ("PCI: endpoint: Enable DMA tests for endpoints with DMA capabilities")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
It's surprising and unfortunate that dma_request_channel() returns NULL
while dma_request_chan_by_mask() returns error pointers. These days
static checkers will catch this so it's not as bad as it could be but
still not ideal.
drivers/pci/endpoint/functions/pci-epf-test.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/pci/endpoint/functions/pci-epf-test.c b/drivers/pci/endpoint/functions/pci-epf-test.c
index 34aac220dd4c..eed6638ab71d 100644
--- a/drivers/pci/endpoint/functions/pci-epf-test.c
+++ b/drivers/pci/endpoint/functions/pci-epf-test.c
@@ -221,7 +221,7 @@ static int pci_epf_test_init_dma_chan(struct pci_epf_test *epf_test)
filter.dma_mask = BIT(DMA_MEM_TO_DEV);
dma_chan = dma_request_channel(mask, epf_dma_filter_fn, &filter);
- if (IS_ERR(dma_chan)) {
+ if (!dma_chan) {
dev_info(dev, "Failed to get private DMA tx channel. Falling back to generic one\n");
goto fail_back_rx;
}
--
2.35.1
next reply other threads:[~2022-07-08 8:42 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-08 8:41 Dan Carpenter [this message]
2022-07-11 5:50 ` [PATCH] PCI: endpoint: IS_ERR() vs NULL bug in pci_epf_test_init_dma_chan() Shunsuke Mie
2022-07-12 7:43 ` Dan Carpenter
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=YsftwaVowtU9/pgn@kili \
--to=dan.carpenter@oracle.com \
--cc=Frank.Li@nxp.com \
--cc=Zhiqiang.Hou@nxp.com \
--cc=bhelgaas@google.com \
--cc=dmaengine@vger.kernel.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=kishon@ti.com \
--cc=kw@linux.com \
--cc=lchen@ambarella.com \
--cc=linux-pci@vger.kernel.org \
--cc=lpieralisi@kernel.org \
--cc=mani@kernel.org \
--cc=mie@igel.co.jp \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.