Skip to content

Commit dc2946a

Browse files
committed
lib-manager: check dma_request_channel() success
dma_request_channel() can return a negative error code. Check for it before using the returned value as a channel number. Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
1 parent 901c0ce commit dc2946a

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

src/library_manager/lib_manager.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -844,6 +844,9 @@ static int lib_manager_dma_init(struct lib_manager_dma_ext *dma_ext, uint32_t dm
844844
}
845845

846846
chan_index = dma_request_channel(dma_ext->dma->z_dev, &dma_id);
847+
if (chan_index < 0)
848+
return chan_index;
849+
847850
dma_ext->chan = &dma_ext->dma->chan[chan_index];
848851
if (!dma_ext->chan)
849852
return -EINVAL;

0 commit comments

Comments
 (0)