Skip to content

Commit e6bc02b

Browse files
committed
audio: host-zephyr: align checks on invalid channel index
Align host-zephyr.c with dai-zephry.c and consider any negative value as an invalid DMA channel. Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
1 parent f26c7bb commit e6bc02b

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/audio/host-zephyr.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -651,7 +651,7 @@ int host_common_trigger(struct host_data *hd, struct comp_dev *dev, int cmd)
651651
if (cmd != COMP_TRIGGER_START && hd->copy_type == COMP_COPY_ONE_SHOT)
652652
return ret;
653653

654-
if (hd->chan_index == -EINVAL) {
654+
if (hd->chan_index < 0) {
655655
comp_err(dev, "no dma channel configured");
656656
return -EINVAL;
657657
}
@@ -785,7 +785,7 @@ __cold void host_common_free(struct host_data *hd)
785785
#endif
786786

787787
/* release DMA channel if not already done by reset */
788-
if (hd->chan_index != -EINVAL) {
788+
if (hd->chan_index >= 0) {
789789
sof_dma_stop(hd->dma, hd->chan_index);
790790
sof_dma_release_channel(hd->dma, hd->chan_index);
791791
hd->chan_index = -EINVAL;
@@ -1171,7 +1171,7 @@ static int host_position(struct comp_dev *dev,
11711171

11721172
void host_common_reset(struct host_data *hd, uint16_t state)
11731173
{
1174-
if (hd->chan_index != -EINVAL) {
1174+
if (hd->chan_index >= 0) {
11751175
sof_dma_stop(hd->dma, hd->chan_index);
11761176
sof_dma_release_channel(hd->dma, hd->chan_index);
11771177
hd->chan_index = -EINVAL;

0 commit comments

Comments
 (0)