PCI: tegra264: dma: Fix mis-matches with ICD

Fix tegra_pcie_dma_stop() return type to bool instead of tegra_pcie_dma_status_t.
Add NULL checks and atleast one DMA channel enable status in
tegra_pcie_dma_initialize().

Bug 5132823

Signed-off-by: Nagarjuna Kristam <nkristam@nvidia.com>
Change-Id: Ie4363a9a63942256f136d018d17af488948e37a1
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3314130
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Nagarjuna Kristam
2025-03-05 14:58:57 +05:30
committed by Jon Hunter
parent 1a1812b7e7
commit c451280883
2 changed files with 17 additions and 4 deletions

View File

@@ -54,6 +54,11 @@ tegra_pcie_dma_status_t tegra_pcie_dma_initialize(struct tegra_pcie_dma_init_inf
{ {
struct tegra_pcie_dma_priv *prv; struct tegra_pcie_dma_priv *prv;
if (!info || !cookie) {
pr_err("%s: NULL info or cookie param\n", __func__);
return TEGRA_PCIE_DMA_FAIL_INVAL_INPUTS;
}
prv = kzalloc(sizeof(*prv), GFP_KERNEL); prv = kzalloc(sizeof(*prv), GFP_KERNEL);
if (!prv) { if (!prv) {
pr_err("Failed to allocate memory for dma_prv\n"); pr_err("Failed to allocate memory for dma_prv\n");
@@ -129,20 +134,23 @@ EXPORT_SYMBOL_GPL(tegra_pcie_dma_submit_xfer);
bool tegra_pcie_dma_stop(void *cookie) bool tegra_pcie_dma_stop(void *cookie)
{ {
struct tegra_pcie_dma_priv *prv = (struct tegra_pcie_dma_priv *)cookie; struct tegra_pcie_dma_priv *prv = (struct tegra_pcie_dma_priv *)cookie;
bool st = false;
if (!cookie) { if (!cookie) {
pr_err("%s: cookie is null\n", __func__); pr_err("%s: cookie is null\n", __func__);
return TEGRA_PCIE_DMA_FAIL_INVAL_INPUTS; goto end;
} }
if (prv->soc == NVPCIE_DMA_SOC_T234) { if (prv->soc == NVPCIE_DMA_SOC_T234) {
return tegra234_pcie_edma_stop(prv->soc_cookie); st = tegra234_pcie_edma_stop(prv->soc_cookie);
} else if (prv->soc == NVPCIE_DMA_SOC_T264) { } else if (prv->soc == NVPCIE_DMA_SOC_T264) {
return tegra264_pcie_xdma_stop(prv->soc_cookie); st = tegra264_pcie_xdma_stop(prv->soc_cookie);
} else { } else {
pr_err("%s: invalid soc id: %d\n", __func__, prv->soc); pr_err("%s: invalid soc id: %d\n", __func__, prv->soc);
return TEGRA_PCIE_DMA_FAIL_INVAL_INPUTS;
} }
end:
return st;
} }
EXPORT_SYMBOL_GPL(tegra_pcie_dma_stop); EXPORT_SYMBOL_GPL(tegra_pcie_dma_stop);

View File

@@ -458,6 +458,11 @@ void *tegra264_pcie_xdma_initialize(struct tegra_pcie_dma_init_info *info, void
} }
} }
if (prv->ch_init == 0U) {
dev_err(prv->dev, "No channel enabled to initialize\n");
goto free_ring;
}
prv->irq_name = kasprintf(GFP_KERNEL, "%s_xdma_lib", dev_name(prv->dev)); prv->irq_name = kasprintf(GFP_KERNEL, "%s_xdma_lib", dev_name(prv->dev));
if (!prv->irq_name) if (!prv->irq_name)
goto free_ring; goto free_ring;