mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-04-12 09:24:17 +00:00
dmaengine: fix null ptr check for __dma_async_device_channel_register()
Add check to pointer after assignment before accessing members.
Fixes: d2fb0a0438
: ("dmaengine: break out channel registration")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Link: https://lore.kernel.org/r/158049351973.45445.3291586905226032744.stgit@djiang5-desk3.ch.intel.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
This commit is contained in:
parent
a9113a90f5
commit
5429b51f60
1 changed files with 3 additions and 0 deletions
|
@ -962,6 +962,9 @@ static int __dma_async_device_channel_register(struct dma_device *device,
|
|||
|
||||
tchan = list_first_entry_or_null(&device->channels,
|
||||
struct dma_chan, device_node);
|
||||
if (!tchan)
|
||||
return -ENODEV;
|
||||
|
||||
if (tchan->dev) {
|
||||
idr_ref = tchan->dev->idr_ref;
|
||||
} else {
|
||||
|
|
Loading…
Add table
Reference in a new issue