Re: [PATCH v7 07/19] dmaengine: ti: k3-udma: Add variant-specific function pointers to udma_dev

[email protected]
Newsgroups org.kernel.vger.dmaengine,org.kernel.vger.linux-devicetree
Message-ID <[email protected]>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Incomplete refactoring leaves hardcoded calls to `navss_psil_pair` and `navss_psil_unpair` instead of using the newly introduced function pointers, breaking variant abstraction.
--

--- Patch [7]: [PATCH v7 07/19] dmaengine: ti: k3-udma: Add variant-specific function pointers to udma_dev ---
commit 65cd7aad4943c26a3ba6403f632bcb28e9c153d7
Author: Sai Sree Kartheek Adivi <[email protected]>

dmaengine: ti: k3-udma: Add variant-specific function pointers to udma_dev

Introduce function pointers in the udma_dev structure to allow
variant-specific implementations for certain operations. This prepares
the driver for supporting multiple K3 UDMA variants, such as UDMA v2,
with minimal code duplication.

> diff --git a/drivers/dma/ti/k3-udma.c b/drivers/dma/ti/k3-udma.c
> index 40ba114ac81dd..195ff948548c3 100644
> --- a/drivers/dma/ti/k3-udma.c
> +++ b/drivers/dma/ti/k3-udma.c

[ ... ]

> @@ -3694,6 +3694,14 @@ static int udma_probe(struct platform_device *pdev)
>  		ud->soc_data = soc->data;
>  	}
>  
> +	// Setup function pointers
> +	ud->start = udma_start;
> +	ud->stop = udma_stop;
> +	ud->reset_chan = udma_reset_chan;
> +	ud->decrement_byte_counters = udma_decrement_byte_counters;
> +	ud->psil_pair = navss_psil_pair;
> +	ud->psil_unpair = navss_psil_unpair;

[Severity: Medium]
Are there still hardcoded calls to navss_psil_pair() and navss_psil_unpair()
in this file that should use these new function pointers?

For example, in udma_alloc_chan_resources():

	ret = navss_psil_pair(ud, uc->config.src_thread, uc->config.dst_thread);

And in udma_free_chan_resources():

	navss_psil_unpair(ud, uc->config.src_thread, uc->config.dst_thread);

There are similar direct calls remaining in bcdma_alloc_chan_resources() and
pktdma_alloc_chan_resources(). Will this bypass the variant abstraction and
potentially cause a NULL pointer dereference on future UDMA variants that lack
TI-SCI PSI-L support (where tisci_psil_ops might not be configured)?

> +
>  	ret = udma_get_mmrs(pdev, ud);
>  	if (ret)
>  		return ret;

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=7
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.