get_dma_channel may return ERR_PTR, so a check is added.
Signed-off-by: Rolf Evers-Fischer <embedded24@xxxxxxxxxxxxxxxx>
---
arch/sh/drivers/dma/dma-api.c | 20 +++++++++++++++++++-
arch/sh/drivers/dma/dma-sysfs.c | 2 +-
2 files changed, 20 insertions(+), 2 deletions(-)
diff --git a/arch/sh/drivers/dma/dma-api.c b/arch/sh/drivers/dma/dma-api.c
index ab9170494dcc..5d6f1a46cc5e 100644
--- a/arch/sh/drivers/dma/dma-api.c
+++ b/arch/sh/drivers/dma/dma-api.c
@@ -94,7 +94,7 @@ int get_dma_residue(unsigned int chan)
struct dma_info *info = get_dma_info(chan);
struct dma_channel *channel = get_dma_channel(chan);
- if (info->ops->get_residue)
+ if (!IS_ERR(channel) && (info->ops->get_residue))