Commit 676338a1 authored by Takashi Iwai's avatar Takashi Iwai Committed by Jaroslav Kysela

[ALSA] opl3 - Fix the unreleased resources

Modules: OPL3

Fix the unreleased resources in the error path of snd_opl3_create().
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 3e23c658
...@@ -409,13 +409,13 @@ int snd_opl3_create(struct snd_card *card, ...@@ -409,13 +409,13 @@ int snd_opl3_create(struct snd_card *card,
if (! integrated) { if (! integrated) {
if ((opl3->res_l_port = request_region(l_port, 2, "OPL2/3 (left)")) == NULL) { if ((opl3->res_l_port = request_region(l_port, 2, "OPL2/3 (left)")) == NULL) {
snd_printk(KERN_ERR "opl3: can't grab left port 0x%lx\n", l_port); snd_printk(KERN_ERR "opl3: can't grab left port 0x%lx\n", l_port);
snd_opl3_free(opl3); snd_device_free(card, opl3);
return -EBUSY; return -EBUSY;
} }
if (r_port != 0 && if (r_port != 0 &&
(opl3->res_r_port = request_region(r_port, 2, "OPL2/3 (right)")) == NULL) { (opl3->res_r_port = request_region(r_port, 2, "OPL2/3 (right)")) == NULL) {
snd_printk(KERN_ERR "opl3: can't grab right port 0x%lx\n", r_port); snd_printk(KERN_ERR "opl3: can't grab right port 0x%lx\n", r_port);
snd_opl3_free(opl3); snd_device_free(card, opl3);
return -EBUSY; return -EBUSY;
} }
} }
...@@ -434,7 +434,7 @@ int snd_opl3_create(struct snd_card *card, ...@@ -434,7 +434,7 @@ int snd_opl3_create(struct snd_card *card,
if ((err = snd_opl3_detect(opl3)) < 0) { if ((err = snd_opl3_detect(opl3)) < 0) {
snd_printd("OPL2/3 chip not detected at 0x%lx/0x%lx\n", snd_printd("OPL2/3 chip not detected at 0x%lx/0x%lx\n",
opl3->l_port, opl3->r_port); opl3->l_port, opl3->r_port);
snd_opl3_free(opl3); snd_device_free(card, opl3);
return err; return err;
} }
/* detect routine returns correct hardware type */ /* detect routine returns correct hardware type */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment