audio: chain_dma: Fix error handling in chain_init()#10744
Open
ujfalusi wants to merge 1 commit intothesofproject:mainfrom
Open
audio: chain_dma: Fix error handling in chain_init()#10744ujfalusi wants to merge 1 commit intothesofproject:mainfrom
ujfalusi wants to merge 1 commit intothesofproject:mainfrom
Conversation
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>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a bug in chain_init() error handling where failure to allocate the link DMA channel could still return success, potentially leading to a later firmware crash when ChainDMA starts.
Changes:
- Return the actual negative error code when host
dma_request_channel()fails (instead of-EINVAL). - Ensure link
dma_request_channel()failures propagate an error viaerrbefore jumping to cleanup. - Make host/link DMA error logs distinguishable by adding “host” vs “link” context.
Comment on lines
+461
to
+462
| comp_err(dev, "host dma_request_channel() failed for %u", | ||
| cd->host_connector_node_id.f.v_index); |
Contributor
Author
There was a problem hiding this comment.
the error code is irrelevant, it is -EINVAL always.
| err = dma_config(cd->dma_host->z_dev, cd->chan_host->index, dma_cfg_host); | ||
| if (err < 0) { | ||
| comp_err(dev, "dma_config() failed"); | ||
| comp_err(dev, "host dma_config() failed for %d", channel); |
Contributor
Author
There was a problem hiding this comment.
printing the 'channel' intentionally here, probably the error code can help, but I expect the underlying code to print on failure points
Comment on lines
+478
to
+479
| comp_err(dev, "link dma_request_channel() failed for %u", | ||
| cd->link_connector_node_id.f.v_index); |
Contributor
Author
There was a problem hiding this comment.
same as for the first suggestion.
| err = dma_config(cd->dma_link->z_dev, cd->chan_link->index, dma_cfg_link); | ||
| if (err < 0) { | ||
| comp_err(dev, "dma_config() failed"); | ||
| comp_err(dev, "link dma_config() failed for %d", channel); |
kv2019i
approved these changes
May 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.