* [PATCH] ALSA: sgio2audio: Only free successfully requested IRQs
@ 2026-09-29 8:45 Runyu Xiao
2026-09-29 15:09 ` Takashi Iwai
0 siblings, 1 reply; 2+ messages in thread
From: Runyu Xiao @ 2026-09-29 8:45 UTC (permalink / raw)
To: Jaroslav Kysela
Cc: Takashi Iwai, Thomas Bogendoerfer, linux-sound, linux-kernel,
stable, Runyu Xiao, Jianhao Xu
snd_sgio2audio_create() calls snd_sgio2audio_free() when an IRQ
request fails. The cleanup helper currently walks the complete IRQ table,
including entries whose request_irq() calls have not been attempted yet.
free_irq() then receives an IRQ and dev_id pair that was never registered.
Pass the number of successfully requested IRQs to the cleanup helper on
the request failure path, while retaining the full-table cleanup for
teardown after all requests have succeeded.
Fixes: 862c2c0a61c5 ("ALSA: ALSA driver for SGI O2 audio board")
Cc: stable@vger.kernel.org
Assisted-by: LLM
Signed-off-by: Runyu Xiao <runyu.xiao@seu.edu.cn>
---
sound/mips/sgio2audio.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/sound/mips/sgio2audio.c b/sound/mips/sgio2audio.c
index 497d84cff..35648b0b9 100644
--- a/sound/mips/sgio2audio.c
+++ b/sound/mips/sgio2audio.c
@@ -742,7 +742,8 @@ static struct {
/* ALSA driver */
-static int snd_sgio2audio_free(struct snd_sgio2audio *chip)
+static int snd_sgio2audio_free(struct snd_sgio2audio *chip,
+ unsigned int irq_count)
{
int i;
@@ -752,7 +753,7 @@ static int snd_sgio2audio_free(struct snd_sgio2audio *chip)
writeq(0, &mace->perif.audio.control);
/* release IRQ's */
- for (i = 0; i < ARRAY_SIZE(snd_sgio2_isr_table); i++)
+ for (i = 0; i < irq_count; i++)
free_irq(snd_sgio2_isr_table[i].irq,
&chip->channel[snd_sgio2_isr_table[i].idx]);
@@ -768,7 +769,7 @@ static int snd_sgio2audio_dev_free(struct snd_device *device)
{
struct snd_sgio2audio *chip = device->device_data;
- return snd_sgio2audio_free(chip);
+ return snd_sgio2audio_free(chip, ARRAY_SIZE(snd_sgio2_isr_table));
}
static const struct snd_device_ops ops = {
@@ -819,7 +820,7 @@ static int snd_sgio2audio_create(struct snd_card *card,
0,
snd_sgio2_isr_table[i].desc,
&chip->channel[snd_sgio2_isr_table[i].idx])) {
- snd_sgio2audio_free(chip);
+ snd_sgio2audio_free(chip, i);
printk(KERN_ERR "sgio2audio: cannot allocate irq %d\n",
snd_sgio2_isr_table[i].irq);
return -EBUSY;
@@ -843,13 +844,13 @@ static int snd_sgio2audio_create(struct snd_card *card,
/* initialize the AD1843 codec */
err = ad1843_init(&chip->ad1843);
if (err < 0) {
- snd_sgio2audio_free(chip);
+ snd_sgio2audio_free(chip, ARRAY_SIZE(snd_sgio2_isr_table));
return err;
}
err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops);
if (err < 0) {
- snd_sgio2audio_free(chip);
+ snd_sgio2audio_free(chip, ARRAY_SIZE(snd_sgio2_isr_table));
return err;
}
*rchip = chip;
--
2.34.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] ALSA: sgio2audio: Only free successfully requested IRQs
2026-09-29 8:45 [PATCH] ALSA: sgio2audio: Only free successfully requested IRQs Runyu Xiao
@ 2026-09-29 15:09 ` Takashi Iwai
0 siblings, 0 replies; 2+ messages in thread
From: Takashi Iwai @ 2026-09-29 15:09 UTC (permalink / raw)
To: Runyu Xiao
Cc: Jaroslav Kysela, Takashi Iwai, Thomas Bogendoerfer, linux-sound,
linux-kernel, stable, Jianhao Xu
On Tue, 29 Sep 2026 10:45:40 +0200,
Runyu Xiao wrote:
>
> snd_sgio2audio_create() calls snd_sgio2audio_free() when an IRQ
> request fails. The cleanup helper currently walks the complete IRQ table,
> including entries whose request_irq() calls have not been attempted yet.
> free_irq() then receives an IRQ and dev_id pair that was never registered.
>
> Pass the number of successfully requested IRQs to the cleanup helper on
> the request failure path, while retaining the full-table cleanup for
> teardown after all requests have succeeded.
>
> Fixes: 862c2c0a61c5 ("ALSA: ALSA driver for SGI O2 audio board")
> Cc: stable@vger.kernel.org
> Assisted-by: LLM
> Signed-off-by: Runyu Xiao <runyu.xiao@seu.edu.cn>
Applied to for-next branch. Thanks.
Takashi
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-09-29 15:09 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-29 8:45 [PATCH] ALSA: sgio2audio: Only free successfully requested IRQs Runyu Xiao
2026-09-29 15:09 ` Takashi Iwai
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®