lkml.org 
[lkml]   [2023]   [Sep]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] arm: kernel: Add error handling in get_dma_residue()
Date
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 --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
\
 
 \ /
  Last update: 2023-09-23 17:40    [W:0.039 / U:1.328 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site