]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
dmaengine: ti: k3-udma: Use cap_mask directly from dma_device structure instead of...
authorYemike Abhilash Chandra <y-abhilashchandra@ti.com>
Thu, 17 Apr 2025 07:55:21 +0000 (13:25 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 22 May 2025 12:31:55 +0000 (14:31 +0200)
commit 8ca9590c39b69b55a8de63d2b21b0d44f523b43a upstream.

Currently, a local dma_cap_mask_t variable is used to store device
cap_mask within udma_of_xlate(). However, the DMA_PRIVATE flag in
the device cap_mask can get cleared when the last channel is released.
This can happen right after storing the cap_mask locally in
udma_of_xlate(), and subsequent dma_request_channel() can fail due to
mismatch in the cap_mask. Fix this by removing the local dma_cap_mask_t
variable and directly using the one from the dma_device structure.

Fixes: 25dcb5dd7b7c ("dmaengine: ti: New driver for K3 UDMA")
Cc: stable@vger.kernel.org
Signed-off-by: Vaishnav Achath <vaishnav.a@ti.com>
Acked-by: Peter Ujfalusi <peter.ujfalusi@gmail.com>
Reviewed-by: Udit Kumar <u-kumar1@ti.com>
Signed-off-by: Yemike Abhilash Chandra <y-abhilashchandra@ti.com>
Link: https://lore.kernel.org/r/20250417075521.623651-1-y-abhilashchandra@ti.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/dma/ti/k3-udma.c

index 6f36445b6f450c3f5e5cc2aea68cd9689fd34140..d1b96f3d908f428d098d459cb7dab9faf97ed10f 100644 (file)
@@ -4253,7 +4253,6 @@ static struct dma_chan *udma_of_xlate(struct of_phandle_args *dma_spec,
                                      struct of_dma *ofdma)
 {
        struct udma_dev *ud = ofdma->of_dma_data;
-       dma_cap_mask_t mask = ud->ddev.cap_mask;
        struct udma_filter_param filter_param;
        struct dma_chan *chan;
 
@@ -4285,7 +4284,7 @@ static struct dma_chan *udma_of_xlate(struct of_phandle_args *dma_spec,
                }
        }
 
-       chan = __dma_request_channel(&mask, udma_dma_filter_fn, &filter_param,
+       chan = __dma_request_channel(&ud->ddev.cap_mask, udma_dma_filter_fn, &filter_param,
                                     ofdma->of_node);
        if (!chan) {
                dev_err(ud->dev, "get channel fail in %s.\n", __func__);