Re: [PATCH v2] ALSA: hda/core: add cleanup in snd_hdac_bus_alloc_stream_pages()

From: Takashi Iwai

Date: Tue Jul 07 2026 - 10:32:59 EST


On Tue, 07 Jul 2026 04:11:39 +0200,
Zhao Dongdong wrote:
>
> From: Zhao Dongdong <zhaodongdong@xxxxxxxxxx>
>
> The current error handling in snd_hdac_bus_alloc_stream_pages()
> returns directly on failure without cleaning up already allocated
> resources. While callers are supposed to release those via
> snd_hdac_bus_free_stream_pages() at destructor, adding explicit
> cleanup makes the function more self-contained and safer against
> future misuse.
>
> Add proper error cleanup path using goto labels to free previously
> allocated BDL DMA buffers, position buffer, and ring buffer in
> reverse allocation order.
>
> Signed-off-by: Zhao Dongdong <zhaodongdong@xxxxxxxxxx>
> ---
> v2: Update subject and description.
> v1: https://lore.kernel.org/all/87pl108lp1.wl-tiwai@xxxxxxx/

Applied now to for-next branch. Thanks.


Takashi