diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2021-09-10 02:05:10 +0300 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2021-09-10 02:05:10 +0300 |
commit | ae79394a628530372e3b0aae4cb9e6495186558c (patch) | |
tree | b9a4bec2c7d707c59a5c421a100d17a1339aebd7 /sound/isa/gus/gus_main.c | |
parent | d6c338a741295c04ed84679153448b2fffd2c9cf (diff) | |
parent | 25fca8c9e0d79ca4c5bb0199dcc52ab0ea4cbd7d (diff) | |
download | linux-ae79394a628530372e3b0aae4cb9e6495186558c.tar.xz |
Merge tag 'sound-fix-5.15-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound
Pull sound fixes from Takashi Iwai:
"A collection of small fixes that have been gathered before rc1,
including a few regression fixes for the problem in the previous pull
request"
* tag 'sound-fix-5.15-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound:
ALSA: gus: Fix repeated probe for ISA interwave card
ALSA: gus: Fix repeated probes of snd_gus_create()
ALSA: vx222: fix null-ptr-deref
ASoC: rockchip: i2s: Fix concurrency between tx/rx
ASoC: mt8195: correct the dts parsing logic about DPTX and HDMITX
ASoC: Intel: boards: Fix CONFIG_SND_SOC_SDW_MOCKUP select
ASoC: dt-bindings: fsl_rpmsg: Add compatible string for i.MX8ULP
ALSA: usb-audio: Add registration quirk for JBL Quantum 800
ASoC: rt5682: fix headset background noise when S3 state
ASoC: dt-bindings: mt8195: remove dependent headers in the example
ASoC: mediatek: SND_SOC_MT8195 should depend on ARCH_MEDIATEK
ASoC: samsung: s3c24xx_simtec: fix spelling mistake "devicec" -> "device"
ASoC: audio-graph: respawn Platform Support
ASoC: mediatek: mt8195: add MTK_PMIC_WRAP dependency
Diffstat (limited to 'sound/isa/gus/gus_main.c')
-rw-r--r-- | sound/isa/gus/gus_main.c | 44 |
1 files changed, 31 insertions, 13 deletions
diff --git a/sound/isa/gus/gus_main.c b/sound/isa/gus/gus_main.c index ae1e2542ee4a..3b46490271fe 100644 --- a/sound/isa/gus/gus_main.c +++ b/sound/isa/gus/gus_main.c @@ -87,10 +87,24 @@ static void snd_gus_init_control(struct snd_gus_card *gus) static int snd_gus_free(struct snd_gus_card *gus) { - if (gus->gf1.res_port2) { - snd_gf1_stop(gus); - snd_gus_init_dma_irq(gus, 0); + if (gus->gf1.res_port2 == NULL) + goto __hw_end; + snd_gf1_stop(gus); + snd_gus_init_dma_irq(gus, 0); + __hw_end: + release_and_free_resource(gus->gf1.res_port1); + release_and_free_resource(gus->gf1.res_port2); + if (gus->gf1.irq >= 0) + free_irq(gus->gf1.irq, (void *) gus); + if (gus->gf1.dma1 >= 0) { + disable_dma(gus->gf1.dma1); + free_dma(gus->gf1.dma1); } + if (!gus->equal_dma && gus->gf1.dma2 >= 0) { + disable_dma(gus->gf1.dma2); + free_dma(gus->gf1.dma2); + } + kfree(gus); return 0; } @@ -116,7 +130,7 @@ int snd_gus_create(struct snd_card *card, }; *rgus = NULL; - gus = devm_kzalloc(card->dev, sizeof(*gus), GFP_KERNEL); + gus = kzalloc(sizeof(*gus), GFP_KERNEL); if (gus == NULL) return -ENOMEM; spin_lock_init(&gus->reg_lock); @@ -142,33 +156,35 @@ int snd_gus_create(struct snd_card *card, gus->gf1.reg_timerctrl = GUSP(gus, TIMERCNTRL); gus->gf1.reg_timerdata = GUSP(gus, TIMERDATA); /* allocate resources */ - gus->gf1.res_port1 = devm_request_region(card->dev, port, 16, - "GUS GF1 (Adlib/SB)"); + gus->gf1.res_port1 = request_region(port, 16, "GUS GF1 (Adlib/SB)"); if (!gus->gf1.res_port1) { snd_printk(KERN_ERR "gus: can't grab SB port 0x%lx\n", port); + snd_gus_free(gus); return -EBUSY; } - gus->gf1.res_port2 = devm_request_region(card->dev, port + 0x100, 12, - "GUS GF1 (Synth)"); + gus->gf1.res_port2 = request_region(port + 0x100, 12, "GUS GF1 (Synth)"); if (!gus->gf1.res_port2) { snd_printk(KERN_ERR "gus: can't grab synth port 0x%lx\n", port + 0x100); + snd_gus_free(gus); return -EBUSY; } - if (irq >= 0 && devm_request_irq(card->dev, irq, snd_gus_interrupt, 0, - "GUS GF1", (void *) gus)) { + if (irq >= 0 && request_irq(irq, snd_gus_interrupt, 0, "GUS GF1", (void *) gus)) { snd_printk(KERN_ERR "gus: can't grab irq %d\n", irq); + snd_gus_free(gus); return -EBUSY; } gus->gf1.irq = irq; card->sync_irq = irq; - if (snd_devm_request_dma(card->dev, dma1, "GUS - 1")) { + if (request_dma(dma1, "GUS - 1")) { snd_printk(KERN_ERR "gus: can't grab DMA1 %d\n", dma1); + snd_gus_free(gus); return -EBUSY; } gus->gf1.dma1 = dma1; if (dma2 >= 0 && dma1 != dma2) { - if (snd_devm_request_dma(card->dev, dma2, "GUS - 2")) { + if (request_dma(dma2, "GUS - 2")) { snd_printk(KERN_ERR "gus: can't grab DMA2 %d\n", dma2); + snd_gus_free(gus); return -EBUSY; } gus->gf1.dma2 = dma2; @@ -193,8 +209,10 @@ int snd_gus_create(struct snd_card *card, gus->gf1.volume_ramp = 25; gus->gf1.smooth_pan = 1; err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, gus, &ops); - if (err < 0) + if (err < 0) { + snd_gus_free(gus); return err; + } *rgus = gus; return 0; } |