-
Notifications
You must be signed in to change notification settings - Fork 350
audio: chain_dma: Fix error handling in chain_init() #10744
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -458,31 +458,34 @@ __cold static int chain_init(struct comp_dev *dev, void *addr, size_t length) | |
| channel = cd->host_connector_node_id.f.v_index; | ||
| channel = dma_request_channel(cd->dma_host->z_dev, &channel); | ||
| if (channel < 0) { | ||
| comp_err(dev, "dma_request_channel() failed"); | ||
| return -EINVAL; | ||
| comp_err(dev, "host dma_request_channel() failed for %u", | ||
| cd->host_connector_node_id.f.v_index); | ||
| return channel; | ||
| } | ||
|
|
||
| cd->chan_host = &cd->dma_host->chan[channel]; | ||
|
|
||
| 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. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. printing the 'channel' intentionally here, probably the error code can help, but I expect the underlying code to print on failure points |
||
| goto error_host; | ||
| } | ||
|
|
||
| /* get link DMA channel */ | ||
| channel = cd->link_connector_node_id.f.v_index; | ||
| channel = dma_request_channel(cd->dma_link->z_dev, &channel); | ||
| if (channel < 0) { | ||
| comp_err(dev, "dma_request_channel() failed"); | ||
| comp_err(dev, "link dma_request_channel() failed for %u", | ||
| cd->link_connector_node_id.f.v_index); | ||
|
Comment on lines
+478
to
+479
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same as for the first suggestion. |
||
| err = channel; | ||
| goto error_host; | ||
| } | ||
|
|
||
| cd->chan_link = &cd->dma_link->chan[channel]; | ||
|
|
||
| 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); | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. again, as intended |
||
| goto error_link; | ||
| } | ||
| return 0; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the error code is irrelevant, it is -EINVAL always.