mirror of
https://github.com/torvalds/linux.git
synced 2026-09-13 15:40:03 +02:00
ASoC: Intel: avs: Clean up streams if their initialization fails
When streams are being initialized the memory allocation may fail.
Have an error path and return early if that is the case.
Fixes: 1affc44ea5 ("ASoC: Intel: avs: PCI driver implementation")
Co-developed-by: Amadeusz Sławiński <amade@asmblr.net>
Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://patch.msgid.link/20260902081814.1590883-6-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
559ea14b7a
commit
f4ba00bb56
|
|
@ -92,16 +92,28 @@ static int avs_hdac_bus_init_streams(struct hdac_bus *bus)
|
|||
{
|
||||
unsigned int cp_streams, pb_streams;
|
||||
unsigned int gcap;
|
||||
int ret;
|
||||
|
||||
gcap = snd_hdac_chip_readw(bus, GCAP);
|
||||
cp_streams = (gcap >> 8) & 0x0F;
|
||||
pb_streams = (gcap >> 12) & 0x0F;
|
||||
bus->num_streams = cp_streams + pb_streams;
|
||||
|
||||
snd_hdac_ext_stream_init_all(bus, 0, cp_streams, SNDRV_PCM_STREAM_CAPTURE);
|
||||
snd_hdac_ext_stream_init_all(bus, cp_streams, pb_streams, SNDRV_PCM_STREAM_PLAYBACK);
|
||||
ret = snd_hdac_ext_stream_init_all(bus, 0, cp_streams, SNDRV_PCM_STREAM_CAPTURE);
|
||||
if (ret)
|
||||
return ret;
|
||||
ret = snd_hdac_ext_stream_init_all(bus, cp_streams, pb_streams, SNDRV_PCM_STREAM_PLAYBACK);
|
||||
if (ret)
|
||||
goto err;
|
||||
|
||||
return snd_hdac_bus_alloc_stream_pages(bus);
|
||||
ret = snd_hdac_bus_alloc_stream_pages(bus);
|
||||
if (ret)
|
||||
goto err;
|
||||
|
||||
return 0;
|
||||
err:
|
||||
snd_hdac_ext_stream_free_all(bus);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static bool avs_hdac_bus_init_chip(struct hdac_bus *bus, bool full_reset)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user