提交 d9a6c8f5 编写于 作者: V Vinod Koul

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: NDan Carpenter <dan.carpenter@oracle.com>
Suggested-by: NZhangfei Gao <zhangfei.gao@linaro.org>
Signed-off-by: NVinod Koul <vinod.koul@intel.com>
上级 7bb587f4
......@@ -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;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册