aboutsummaryrefslogtreecommitdiffstats
path: root/sound/isa/es1688/es1688_lib.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/isa/es1688/es1688_lib.c')
-rw-r--r--sound/isa/es1688/es1688_lib.c34
1 files changed, 23 insertions, 11 deletions
diff --git a/sound/isa/es1688/es1688_lib.c b/sound/isa/es1688/es1688_lib.c
index 1d47be8170b5..b3b4f15e45ba 100644
--- a/sound/isa/es1688/es1688_lib.c
+++ b/sound/isa/es1688/es1688_lib.c
@@ -612,10 +612,10 @@ static int snd_es1688_capture_close(struct snd_pcm_substream *substream)
612 612
613static int snd_es1688_free(struct snd_es1688 *chip) 613static int snd_es1688_free(struct snd_es1688 *chip)
614{ 614{
615 if (chip->res_port) { 615 if (chip->hardware != ES1688_HW_UNDEF)
616 snd_es1688_init(chip, 0); 616 snd_es1688_init(chip, 0);
617 if (chip->res_port)
617 release_and_free_resource(chip->res_port); 618 release_and_free_resource(chip->res_port);
618 }
619 if (chip->irq >= 0) 619 if (chip->irq >= 0)
620 free_irq(chip->irq, (void *) chip); 620 free_irq(chip->irq, (void *) chip);
621 if (chip->dma8 >= 0) { 621 if (chip->dma8 >= 0) {
@@ -657,19 +657,27 @@ int snd_es1688_create(struct snd_card *card,
657 return -ENOMEM; 657 return -ENOMEM;
658 chip->irq = -1; 658 chip->irq = -1;
659 chip->dma8 = -1; 659 chip->dma8 = -1;
660 chip->hardware = ES1688_HW_UNDEF;
660 661
661 if ((chip->res_port = request_region(port + 4, 12, "ES1688")) == NULL) { 662 chip->res_port = request_region(port + 4, 12, "ES1688");
663 if (chip->res_port == NULL) {
662 snd_printk(KERN_ERR "es1688: can't grab port 0x%lx\n", port + 4); 664 snd_printk(KERN_ERR "es1688: can't grab port 0x%lx\n", port + 4);
663 return -EBUSY; 665 err = -EBUSY;
666 goto exit;
664 } 667 }
665 if (request_irq(irq, snd_es1688_interrupt, 0, "ES1688", (void *) chip)) { 668
669 err = request_irq(irq, snd_es1688_interrupt, 0, "ES1688", (void *) chip);
670 if (err < 0) {
666 snd_printk(KERN_ERR "es1688: can't grab IRQ %d\n", irq); 671 snd_printk(KERN_ERR "es1688: can't grab IRQ %d\n", irq);
667 return -EBUSY; 672 goto exit;
668 } 673 }
674
669 chip->irq = irq; 675 chip->irq = irq;
670 if (request_dma(dma8, "ES1688")) { 676 err = request_dma(dma8, "ES1688");
677
678 if (err < 0) {
671 snd_printk(KERN_ERR "es1688: can't grab DMA8 %d\n", dma8); 679 snd_printk(KERN_ERR "es1688: can't grab DMA8 %d\n", dma8);
672 return -EBUSY; 680 goto exit;
673 } 681 }
674 chip->dma8 = dma8; 682 chip->dma8 = dma8;
675 683
@@ -685,14 +693,18 @@ int snd_es1688_create(struct snd_card *card,
685 693
686 err = snd_es1688_probe(chip); 694 err = snd_es1688_probe(chip);
687 if (err < 0) 695 if (err < 0)
688 return err; 696 goto exit;
689 697
690 err = snd_es1688_init(chip, 1); 698 err = snd_es1688_init(chip, 1);
691 if (err < 0) 699 if (err < 0)
692 return err; 700 goto exit;
693 701
694 /* Register device */ 702 /* Register device */
695 return snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops); 703 err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops);
704exit:
705 if (err)
706 snd_es1688_free(chip);
707 return err;
696} 708}
697 709
698static struct snd_pcm_ops snd_es1688_playback_ops = { 710static struct snd_pcm_ops snd_es1688_playback_ops = {