Skip to content

Commit 04fff95

Browse files
keyonjieplbossart
authored andcommitted
ASoC: SOF: hda-trace: cleanup for hda_dsp_trace_init()
We need add error handling for hda_dsp_trace_prepare(), put stream at prepare fail. Here also remove the hda NULL check, we assume hda is available for those hda-xxx.c drivers. Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
1 parent 6d1ebb7 commit 04fff95

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

sound/soc/sof/intel/hda-trace.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,12 @@ int hda_dsp_trace_init(struct snd_sof_dev *sdev, u32 *tag)
4242
{
4343
struct sof_intel_hda_dev *hda =
4444
(struct sof_intel_hda_dev *)sdev->pdata->hw_pdata;
45+
int ret;
4546

4647
hda->dtrace_stream = hda_dsp_stream_get(sdev,
4748
SNDRV_PCM_STREAM_CAPTURE);
4849

49-
if (hda && !hda->dtrace_stream) {
50+
if (!hda->dtrace_stream) {
5051
dev_err(sdev->dev,
5152
"error: no available capture stream for DMA trace\n");
5253
return -ENODEV;
@@ -58,7 +59,15 @@ int hda_dsp_trace_init(struct snd_sof_dev *sdev, u32 *tag)
5859
* initialize capture stream, set BDL address and return corresponding
5960
* stream tag which will be sent to the firmware by IPC message.
6061
*/
61-
return hda_dsp_trace_prepare(sdev);
62+
ret = hda_dsp_trace_prepare(sdev);
63+
if (ret < 0) {
64+
dev_err(sdev->dev, "error: hdac trace init failed: %x\n", ret);
65+
hda_dsp_stream_put(sdev, SNDRV_PCM_STREAM_CAPTURE, *tag);
66+
hda->dtrace_stream = NULL;
67+
*tag = 0;
68+
}
69+
70+
return ret;
6271
}
6372

6473
int hda_dsp_trace_release(struct snd_sof_dev *sdev)

0 commit comments

Comments
 (0)