summaryrefslogtreecommitdiffstats
path: root/drivers/dma/dmaengine.c
diff options
context:
space:
mode:
authorVinod Koul <vinod.koul@intel.com>2013-08-19 10:47:26 +0530
committerVinod Koul <vinod.koul@intel.com>2013-08-19 10:48:13 +0530
commitd9a6c8f52d1039333bef6234126485409e8f7501 (patch)
tree4ba0b0dfb0cc814f633d1c7b1b88dcc8d13f2af7 /drivers/dma/dmaengine.c
parent7bb587f4eef8f71ce589f360ab99bb54ab0fc85d (diff)
dmaengine: fix - error: potential NULL dereference 'chan'
commit 7bb587f4 "dmaengine: add interface of dma_get_slave_channel" introduced the above error so fix it Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Suggested-by: Zhangfei Gao <zhangfei.gao@linaro.org> Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Diffstat (limited to 'drivers/dma/dmaengine.c')
-rw-r--r--drivers/dma/dmaengine.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/dma/dmaengine.c b/drivers/dma/dmaengine.c
index 5932ab164ac..755ba2f4f1d 100644
--- a/drivers/dma/dmaengine.c
+++ b/drivers/dma/dmaengine.c
@@ -514,16 +514,16 @@ struct dma_chan *dma_get_slave_channel(struct dma_chan *chan)
/* lock against __dma_request_channel */
mutex_lock(&dma_list_mutex);
- if (chan->client_count == 0)
+ if (chan->client_count == 0) {
err = dma_chan_get(chan);
- else
+ if (err)
+ pr_debug("%s: failed to get %s: (%d)\n",
+ __func__, dma_chan_name(chan), err);
+ } else
chan = NULL;
mutex_unlock(&dma_list_mutex);
- if (err)
- pr_debug("%s: failed to get %s: (%d)\n",
- __func__, dma_chan_name(chan), err);
return chan;
}