diff mbox series

[v3] PCI: endpoint: pci-epf-test: Fix NULL ptr assignment to dma_chan_rx

Message ID 20241227160841.92382-1-khalfella@gmail.com (mailing list archive)
State Awaiting Upstream
Delegated to: Krzysztof WilczyƄski
Headers show
Series [v3] PCI: endpoint: pci-epf-test: Fix NULL ptr assignment to dma_chan_rx | expand

Commit Message

Mohamed Khalfella Dec. 27, 2024, 4:08 p.m. UTC
If dma_chan_tx allocation fails, set dma_chan_rx to NULL after it is
freed.

Fixes: 8353813c88ef ("PCI: endpoint: Enable DMA tests for endpoints with DMA capabilities")
Signed-off-by: Mohamed Khalfella <khalfella@gmail.com>
Reviewed-by: Niklas Cassel <cassel@kernel.org>
---
 drivers/pci/endpoint/functions/pci-epf-test.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Manivannan Sadhasivam Dec. 30, 2024, 7:26 a.m. UTC | #1
On Fri, Dec 27, 2024 at 08:08:41AM -0800, Mohamed Khalfella wrote:
> If dma_chan_tx allocation fails, set dma_chan_rx to NULL after it is
> freed.
> 
> Fixes: 8353813c88ef ("PCI: endpoint: Enable DMA tests for endpoints with DMA capabilities")
> Signed-off-by: Mohamed Khalfella <khalfella@gmail.com>

Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>

Btw, you are sending next version as a reply to the previous one. But you should
send it separately.

- Mani

> Reviewed-by: Niklas Cassel <cassel@kernel.org>
> ---
>  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 ef6677f34116..d90c8be7371e 100644
> --- a/drivers/pci/endpoint/functions/pci-epf-test.c
> +++ b/drivers/pci/endpoint/functions/pci-epf-test.c
> @@ -251,7 +251,7 @@ static int pci_epf_test_init_dma_chan(struct pci_epf_test *epf_test)
>  
>  fail_back_rx:
>  	dma_release_channel(epf_test->dma_chan_rx);
> -	epf_test->dma_chan_tx = NULL;
> +	epf_test->dma_chan_rx = NULL;
>  
>  fail_back_tx:
>  	dma_cap_zero(mask);
> -- 
> 2.45.2
>
Mohamed Khalfella Dec. 30, 2024, 6:36 p.m. UTC | #2
On 2024-12-30 12:56:45 +0530, Manivannan Sadhasivam wrote:
> On Fri, Dec 27, 2024 at 08:08:41AM -0800, Mohamed Khalfella wrote:
> > If dma_chan_tx allocation fails, set dma_chan_rx to NULL after it is
> > freed.
> > 
> > Fixes: 8353813c88ef ("PCI: endpoint: Enable DMA tests for endpoints with DMA capabilities")
> > Signed-off-by: Mohamed Khalfella <khalfella@gmail.com>
> 
> Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
> 
> Btw, you are sending next version as a reply to the previous one. But you should
> send it separately.
> 

Noted. Next time will try to do that.
diff mbox series

Patch

diff --git a/drivers/pci/endpoint/functions/pci-epf-test.c b/drivers/pci/endpoint/functions/pci-epf-test.c
index ef6677f34116..d90c8be7371e 100644
--- a/drivers/pci/endpoint/functions/pci-epf-test.c
+++ b/drivers/pci/endpoint/functions/pci-epf-test.c
@@ -251,7 +251,7 @@  static int pci_epf_test_init_dma_chan(struct pci_epf_test *epf_test)
 
 fail_back_rx:
 	dma_release_channel(epf_test->dma_chan_rx);
-	epf_test->dma_chan_tx = NULL;
+	epf_test->dma_chan_rx = NULL;
 
 fail_back_tx:
 	dma_cap_zero(mask);