aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSerge Semin <[email protected]>2023-01-13 20:14:04 +0300
committerBjorn Helgaas <[email protected]>2023-02-10 17:15:23 -0600
commit4ac1662105926c963d19e66caab16c77de01e681 (patch)
tree154982da53d2126b1b5aa655dd422fe349181739
parent53c0e2f9b808fafaea7bec91eeec48046bcaaba0 (diff)
dmaengine: dw-edma: Skip cleanup procedure if no private data found
DW eDMA driver private data is preserved in the passed DW eDMA chip info structure. If the probe fails or for some reason the passed info object doesn't have the private data pointer initialized, halt the DMA device cleanup procedure to prevent system crashes. Link: https://lore.kernel.org/r/[email protected] Tested-by: Manivannan Sadhasivam <[email protected]> Signed-off-by: Serge Semin <[email protected]> Signed-off-by: Lorenzo Pieralisi <[email protected]> Signed-off-by: Bjorn Helgaas <[email protected]> Reviewed-by: Manivannan Sadhasivam <[email protected]> Acked-by: Vinod Koul <[email protected]>
-rw-r--r--drivers/dma/dw-edma/dw-edma-core.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/dma/dw-edma/dw-edma-core.c b/drivers/dma/dw-edma/dw-edma-core.c
index e3671bfbe186..1906a836f0aa 100644
--- a/drivers/dma/dw-edma/dw-edma-core.c
+++ b/drivers/dma/dw-edma/dw-edma-core.c
@@ -1011,6 +1011,10 @@ int dw_edma_remove(struct dw_edma_chip *chip)
struct dw_edma *dw = chip->dw;
int i;
+ /* Skip removal if no private data found */
+ if (!dw)
+ return -ENODEV;
+
/* Disable eDMA */
dw_edma_v0_core_off(dw);