* [PATCH v2] PCI: endpoint: IS_ERR() vs NULL bug in pci_epf_test_init_dma_chan()
@ 2022-07-12 14:33 Dan Carpenter
2022-07-12 15:18 ` Bjorn Helgaas
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2022-07-12 14:33 UTC (permalink / raw)
To: Kishon Vijay Abraham I
Cc: Lorenzo Pieralisi, Krzysztof Wilczyński, Bjorn Helgaas,
Hou Zhiqiang, Shunsuke Mie, Li Chen, Frank Li,
Manivannan Sadhasivam, linux-pci, kernel-janitors
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>
---
v2: Clean up the first IS_ERR_OR_NULL() check as well
drivers/pci/endpoint/functions/pci-epf-test.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/pci/endpoint/functions/pci-epf-test.c b/drivers/pci/endpoint/functions/pci-epf-test.c
index 34aac220dd4c..36b1801a061b 100644
--- a/drivers/pci/endpoint/functions/pci-epf-test.c
+++ b/drivers/pci/endpoint/functions/pci-epf-test.c
@@ -211,7 +211,7 @@ static int pci_epf_test_init_dma_chan(struct pci_epf_test *epf_test)
dma_cap_zero(mask);
dma_cap_set(DMA_SLAVE, mask);
dma_chan = dma_request_channel(mask, epf_dma_filter_fn, &filter);
- if (IS_ERR_OR_NULL(dma_chan)) {
+ if (!dma_chan) {
dev_info(dev, "Failed to get private DMA rx channel. Falling back to generic one\n");
goto fail_back_tx;
}
@@ -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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2] PCI: endpoint: IS_ERR() vs NULL bug in pci_epf_test_init_dma_chan()
2022-07-12 14:33 [PATCH v2] PCI: endpoint: IS_ERR() vs NULL bug in pci_epf_test_init_dma_chan() Dan Carpenter
@ 2022-07-12 15:18 ` Bjorn Helgaas
0 siblings, 0 replies; 2+ messages in thread
From: Bjorn Helgaas @ 2022-07-12 15:18 UTC (permalink / raw)
To: Dan Carpenter
Cc: Kishon Vijay Abraham I, Lorenzo Pieralisi,
Krzysztof Wilczyński, Bjorn Helgaas, Hou Zhiqiang,
Shunsuke Mie, Li Chen, Frank Li, Manivannan Sadhasivam, linux-pci,
kernel-janitors
On Tue, Jul 12, 2022 at 05:33:45PM +0300, Dan Carpenter wrote:
> 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>
Thanks, I squashed this into fff86dfbbf82 on my pci/ctrl/dwc-edma
branch. I added a mention of Shunsuke's previous post of a similar
fix, but merged this one because it fixes both the RX and TX paths.
> ---
> v2: Clean up the first IS_ERR_OR_NULL() check as well
>
> drivers/pci/endpoint/functions/pci-epf-test.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/pci/endpoint/functions/pci-epf-test.c b/drivers/pci/endpoint/functions/pci-epf-test.c
> index 34aac220dd4c..36b1801a061b 100644
> --- a/drivers/pci/endpoint/functions/pci-epf-test.c
> +++ b/drivers/pci/endpoint/functions/pci-epf-test.c
> @@ -211,7 +211,7 @@ static int pci_epf_test_init_dma_chan(struct pci_epf_test *epf_test)
> dma_cap_zero(mask);
> dma_cap_set(DMA_SLAVE, mask);
> dma_chan = dma_request_channel(mask, epf_dma_filter_fn, &filter);
> - if (IS_ERR_OR_NULL(dma_chan)) {
> + if (!dma_chan) {
> dev_info(dev, "Failed to get private DMA rx channel. Falling back to generic one\n");
> goto fail_back_tx;
> }
> @@ -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
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-07-12 15:21 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-12 14:33 [PATCH v2] PCI: endpoint: IS_ERR() vs NULL bug in pci_epf_test_init_dma_chan() Dan Carpenter
2022-07-12 15:18 ` Bjorn Helgaas
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox