提交 5429b51f 编写于 作者: D Dave Jiang 提交者: Vinod Koul

dmaengine: fix null ptr check for __dma_async_device_channel_register()

Add check to pointer after assignment before accessing members.

Fixes: d2fb0a04: ("dmaengine: break out channel registration")
Reported-by: NDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: NDave Jiang <dave.jiang@intel.com>
Link: https://lore.kernel.org/r/158049351973.45445.3291586905226032744.stgit@djiang5-desk3.ch.intel.comSigned-off-by: NVinod Koul <vkoul@kernel.org>
上级 a9113a90
...@@ -962,6 +962,9 @@ static int __dma_async_device_channel_register(struct dma_device *device, ...@@ -962,6 +962,9 @@ static int __dma_async_device_channel_register(struct dma_device *device,
tchan = list_first_entry_or_null(&device->channels, tchan = list_first_entry_or_null(&device->channels,
struct dma_chan, device_node); struct dma_chan, device_node);
if (!tchan)
return -ENODEV;
if (tchan->dev) { if (tchan->dev) {
idr_ref = tchan->dev->idr_ref; idr_ref = tchan->dev->idr_ref;
} else { } else {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册