Re: [PATCH] ASoC: intel: avs: Fix potential memory leak in avs_pci_probe()

From: Abdun Nihaal

Date: Thu Nov 13 2025 - 06:35:28 EST


On Thu, Nov 13, 2025 at 12:14:30PM +0100, Cezary Rojewski wrote:
> I'd suggest to be strict, no need for lengthy message when addressing simple
> problem. Your title already answers _what_?, the message shall answer
> _why_?. Example:
>
> snd_hdac_ext_bus_get_ml_capabilities() may fail when allocating LINK
> resources.

Sure, I'll shorten the commit message.

> > Compile tested only. Issue found using static analysis.
>
> Well, it's good to do at least a simple functional test before sending, see
> below.

I don't have the hardware to test it.

> > snd_hdac_ext_stream_free_all(bus);
> > err_init_streams:
> > + snd_hdac_ext_link_free_all(bus);
> > +err_ml_capabilities:
>
> Don't believe that's correct. -ENOMEM may be returned when allocating
> resources for an entry N>0. Skipping snd_hdac_ext_link_free_all() may leave
> things at status quo - memory leak.
>
> > iounmap(adev->dsp_ba);

Yes, I missed that. Will fix it and send a v2 patch.
Thanks for reviewing.

Regards,
Nihaal