Skip to content

Commit f829f42

Browse files
committed
audio: chain_dma: Fix error handling in chain_init()
If the dma_request_channel() for the link fails we print the error, jump to error_host to release the channel and return with success. This can lead to firmware crash later on when the ChainDMA is started. Correct the error handling by setting the err correctly in this case and also update the prints to print unique strings and information to help debugging. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
1 parent f1400dc commit f829f42

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

src/audio/chain_dma.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -458,31 +458,34 @@ __cold static int chain_init(struct comp_dev *dev, void *addr, size_t length)
458458
channel = cd->host_connector_node_id.f.v_index;
459459
channel = dma_request_channel(cd->dma_host->z_dev, &channel);
460460
if (channel < 0) {
461-
comp_err(dev, "dma_request_channel() failed");
462-
return -EINVAL;
461+
comp_err(dev, "host dma_request_channel() failed for %u",
462+
cd->host_connector_node_id.f.v_index);
463+
return channel;
463464
}
464465

465466
cd->chan_host = &cd->dma_host->chan[channel];
466467

467468
err = dma_config(cd->dma_host->z_dev, cd->chan_host->index, dma_cfg_host);
468469
if (err < 0) {
469-
comp_err(dev, "dma_config() failed");
470+
comp_err(dev, "host dma_config() failed for %d", channel);
470471
goto error_host;
471472
}
472473

473474
/* get link DMA channel */
474475
channel = cd->link_connector_node_id.f.v_index;
475476
channel = dma_request_channel(cd->dma_link->z_dev, &channel);
476477
if (channel < 0) {
477-
comp_err(dev, "dma_request_channel() failed");
478+
comp_err(dev, "link dma_request_channel() failed for %u",
479+
cd->link_connector_node_id.f.v_index);
480+
err = channel;
478481
goto error_host;
479482
}
480483

481484
cd->chan_link = &cd->dma_link->chan[channel];
482485

483486
err = dma_config(cd->dma_link->z_dev, cd->chan_link->index, dma_cfg_link);
484487
if (err < 0) {
485-
comp_err(dev, "dma_config() failed");
488+
comp_err(dev, "link dma_config() failed for %d", channel);
486489
goto error_link;
487490
}
488491
return 0;

0 commit comments

Comments
 (0)