diff mbox series

arm: kernel: Add error handling in get_dma_residue()

Message ID 20230923152415.41073-1-liuhaoran14@163.com (mailing list archive)
State New, archived
Headers show
Series arm: kernel: Add error handling in get_dma_residue() | expand

Commit Message

Haoran Liu Sept. 23, 2023, 3:24 p.m. UTC
This patch adds error-handling for the dma_channel() inside
the get_dma_residue().

Signed-off-by: liuhaoran <liuhaoran14@163.com>
---
 arch/arm/kernel/dma.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

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;