Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions sound/soc/sof/intel/hda-stream.c
Original file line number Diff line number Diff line change
Expand Up @@ -659,6 +659,10 @@ void hda_dsp_stream_free(struct snd_sof_dev *sdev)
if (bus->posbuf.area)
snd_dma_free_pages(&bus->posbuf);

/* free the CORB/RIRB ringbuffers buffer */
if (bus->rb.area)
snd_dma_free_pages(&bus->rb);

list_for_each_entry_safe(s, _s, &bus->stream_list, list) {
/* TODO: decouple */

Expand Down
6 changes: 1 addition & 5 deletions sound/soc/sof/intel/hda.c
Original file line number Diff line number Diff line change
Expand Up @@ -591,11 +591,7 @@ int hda_dsp_probe(struct snd_sof_dev *sdev)
ret = hda_dsp_stream_init(sdev);
if (ret < 0) {
dev_err(&pci->dev, "error: failed to init streams\n");
/*
* not all errors are due to memory issues, but trying
* to free everything does not harm
*/
goto err;
goto free_streams;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe better to handle this inside hda_dsp_stream_init() for different failed points IMO.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is the first idea flashing into my mind. To free memory at different stage is complex. I like the style of hda_dsp_stream_free. @plbossart which one do you prefer?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of fixing the code, I decided to fix the comment... See 3a420e9

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to be clearer, I have the same fix in #274, but I also fixed the comment since all errors are actually due to memory allocation

}

/*
Expand Down