[PATCH] arm: kernel: Add error handling in get_dma_residue()
From: liuhaoran
Date: Sat Sep 23 2023 - 11:40:00 EST
This patch adds error-handling for the dma_channel() inside
the get_dma_residue().
Signed-off-by: liuhaoran <liuhaoran14@xxxxxxx>
---
arch/arm/kernel/dma.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm/kernel/dma.c b/arch/arm/kernel/dma.c
index ba15b8666498..80b3e3506cfa 100644
--- a/arch/arm/kernel/dma.c
+++ b/arch/arm/kernel/dma.c
@@ -253,7 +253,7 @@ int get_dma_residue(unsigned int chan)
dma_t *dma = dma_channel(chan);
int ret = 0;
- if (dma->d_ops->residue)
+ if (dma && dma->d_ops->residue)
ret = dma->d_ops->residue(chan, dma);
return ret;
--
2.17.1