PCI: endpoint: pci-epf-test: Set dma_chan_rx pointer to NULL on error
authorMohamed Khalfella <khalfella@gmail.com>
Fri, 27 Dec 2024 16:08:41 +0000 (08:08 -0800)
committerBjorn Helgaas <bhelgaas@google.com>
Tue, 21 Jan 2025 15:44:13 +0000 (09:44 -0600)
If dma_chan_tx allocation fails, set dma_chan_rx to NULL after it is
freed.

Link: https://lore.kernel.org/r/20241227160841.92382-1-khalfella@gmail.com
Fixes: 8353813c88ef ("PCI: endpoint: Enable DMA tests for endpoints with DMA capabilities")
Signed-off-by: Mohamed Khalfella <khalfella@gmail.com>
[kwilczynski: commit log]
Signed-off-by: Krzysztof WilczyƄski <kwilczynski@kernel.org>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Niklas Cassel <cassel@kernel.org>
Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
drivers/pci/endpoint/functions/pci-epf-test.c

index ef6677f34116e193d9d20d477647a6d57dffc0a2..d90c8be7371e04df9bd8fb6db0feb322cda04dff 100644 (file)
@@ -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);