mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2026-09-22 09:34:56 +02:00
ALSA: aoa: Skip devices with no codecs in i2sbus_resume()
[ Upstream commitfd7df93013] In i2sbus_resume(), skip devices with an empty codec list, which avoids using an uninitialized 'sysclock_factor' in the 32-bit format path in i2sbus_pcm_prepare(). In i2sbus_pcm_prepare(), replace two list_for_each_entry() loops with a single list_first_entry() now that the codec list is guaranteed to be non-empty by all callers. Fixes:f3d9478b2c("[ALSA] snd-aoa: add snd-aoa") Cc: stable@vger.kernel.org Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev> Link: https://patch.msgid.link/20260310102921.210109-3-thorsten.blum@linux.dev Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Sasha Levin <sashal@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
32fbdb6d67
commit
69b3a50dee
@@ -411,6 +411,9 @@ static int i2sbus_resume(struct macio_dev* dev)
|
||||
int err, ret = 0;
|
||||
|
||||
list_for_each_entry(i2sdev, &control->list, item) {
|
||||
if (list_empty(&i2sdev->sound.codec_list))
|
||||
continue;
|
||||
|
||||
/* reset i2s bus format etc. */
|
||||
i2sbus_pcm_prepare_both(i2sdev);
|
||||
|
||||
|
||||
@@ -411,6 +411,9 @@ static int i2sbus_pcm_prepare(struct i2sbus_dev *i2sdev, int in)
|
||||
/* set stop command */
|
||||
command->command = cpu_to_le16(DBDMA_STOP);
|
||||
|
||||
cii = list_first_entry(&i2sdev->sound.codec_list,
|
||||
struct codec_info_item, list);
|
||||
|
||||
/* ok, let's set the serial format and stuff */
|
||||
switch (runtime->format) {
|
||||
/* 16 bit formats */
|
||||
@@ -418,13 +421,7 @@ static int i2sbus_pcm_prepare(struct i2sbus_dev *i2sdev, int in)
|
||||
case SNDRV_PCM_FORMAT_U16_BE:
|
||||
/* FIXME: if we add different bus factors we need to
|
||||
* do more here!! */
|
||||
bi.bus_factor = 0;
|
||||
list_for_each_entry(cii, &i2sdev->sound.codec_list, list) {
|
||||
bi.bus_factor = cii->codec->bus_factor;
|
||||
break;
|
||||
}
|
||||
if (!bi.bus_factor)
|
||||
return -ENODEV;
|
||||
bi.bus_factor = cii->codec->bus_factor;
|
||||
input_16bit = 1;
|
||||
break;
|
||||
case SNDRV_PCM_FORMAT_S32_BE:
|
||||
@@ -438,10 +435,7 @@ static int i2sbus_pcm_prepare(struct i2sbus_dev *i2sdev, int in)
|
||||
return -EINVAL;
|
||||
}
|
||||
/* we assume all sysclocks are the same! */
|
||||
list_for_each_entry(cii, &i2sdev->sound.codec_list, list) {
|
||||
bi.sysclock_factor = cii->codec->sysclock_factor;
|
||||
break;
|
||||
}
|
||||
bi.sysclock_factor = cii->codec->sysclock_factor;
|
||||
|
||||
if (clock_and_divisors(bi.sysclock_factor,
|
||||
bi.bus_factor,
|
||||
|
||||
Reference in New Issue
Block a user