diff --git a/src/audio/host.c b/src/audio/host.c index 930caceac..d346b5e17 100644 --- a/src/audio/host.c +++ b/src/audio/host.c @@ -462,14 +462,19 @@ static int host_trigger(struct comp_dev *dev, int cmd) ret = comp_set_state(dev, cmd); if (ret < 0) - return ret; + goto out; switch (cmd) { case COMP_TRIGGER_STOP: ret = host_stop(dev); break; case COMP_TRIGGER_START: - dma_start(hd->dma, hd->chan); + ret = dma_start(hd->dma, hd->chan); + if (ret < 0) { + trace_host_error("TsF"); + trace_error_value(ret); + goto out; + } /* preload first playback period for preloader task */ if (dev->params.direction == SOF_IPC_STREAM_PLAYBACK) { @@ -485,6 +490,7 @@ static int host_trigger(struct comp_dev *dev, int cmd) break; } +out: return ret; } @@ -700,7 +706,12 @@ static int host_params(struct comp_dev *dev) trace_host_error("eDC"); return -ENODEV; } - dma_set_config(hd->dma, hd->chan, &hd->config); + err = dma_set_config(hd->dma, hd->chan, &hd->config); + if (err < 0) { + trace_host_error("eDc"); + dma_channel_put(hd->dma, hd->chan); + return err; + } #endif return 0; @@ -844,6 +855,7 @@ static int host_copy(struct comp_dev *dev) { struct host_data *hd = comp_get_drvdata(dev); struct dma_sg_elem *local_elem; + int ret; tracev_host("cpy"); @@ -888,13 +900,23 @@ static int host_copy(struct comp_dev *dev) host_gw_dma_update(dev); /* tell gateway to copy another period */ - dma_copy(hd->dma, hd->chan, hd->period_bytes); + ret = dma_copy(hd->dma, hd->chan, hd->period_bytes); + if (ret < 0) + goto out; #else /* do DMA transfer */ - dma_set_config(hd->dma, hd->chan, &hd->config); - dma_start(hd->dma, hd->chan); + ret = dma_set_config(hd->dma, hd->chan, &hd->config); + if (ret < 0) + goto out; + ret = dma_start(hd->dma, hd->chan); + if (ret < 0) + goto out; #endif return dev->frames; +out: + trace_host_error("CpF"); + trace_error_value(ret); + return ret; } struct comp_driver comp_host = {