diff options
author | Vinod Koul <vinod.koul@intel.com> | 2013-08-19 01:17:26 -0400 |
---|---|---|
committer | Vinod Koul <vinod.koul@intel.com> | 2013-08-19 01:18:13 -0400 |
commit | d9a6c8f52d1039333bef6234126485409e8f7501 (patch) | |
tree | 4ba0b0dfb0cc814f633d1c7b1b88dcc8d13f2af7 /drivers/dma | |
parent | 7bb587f4eef8f71ce589f360ab99bb54ab0fc85d (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')
-rw-r--r-- | drivers/dma/dmaengine.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/dma/dmaengine.c b/drivers/dma/dmaengine.c index 5932ab164ace..755ba2f4f1d5 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) | |||
514 | /* lock against __dma_request_channel */ | 514 | /* lock against __dma_request_channel */ |
515 | mutex_lock(&dma_list_mutex); | 515 | mutex_lock(&dma_list_mutex); |
516 | 516 | ||
517 | if (chan->client_count == 0) | 517 | if (chan->client_count == 0) { |
518 | err = dma_chan_get(chan); | 518 | err = dma_chan_get(chan); |
519 | else | 519 | if (err) |
520 | pr_debug("%s: failed to get %s: (%d)\n", | ||
521 | __func__, dma_chan_name(chan), err); | ||
522 | } else | ||
520 | chan = NULL; | 523 | chan = NULL; |
521 | 524 | ||
522 | mutex_unlock(&dma_list_mutex); | 525 | mutex_unlock(&dma_list_mutex); |
523 | 526 | ||
524 | if (err) | ||
525 | pr_debug("%s: failed to get %s: (%d)\n", | ||
526 | __func__, dma_chan_name(chan), err); | ||
527 | 527 | ||
528 | return chan; | 528 | return chan; |
529 | } | 529 | } |