upgrade to linux 2.6.10-1.12_FC2
[linux-2.6.git] / sound / pci / trident / trident_main.c
index 46d050d..8c02d47 100644 (file)
@@ -3537,12 +3537,15 @@ int __devinit snd_trident_create(snd_card_t * card,
        if (pci_set_dma_mask(pci, 0x3fffffff) < 0 ||
            pci_set_consistent_dma_mask(pci, 0x3fffffff) < 0) {
                snd_printk("architecture does not support 30bit PCI busmaster DMA\n");
+               pci_disable_device(pci);
                return -ENXIO;
        }
        
        trident = kcalloc(1, sizeof(*trident), GFP_KERNEL);
-       if (trident == NULL)
+       if (trident == NULL) {
+               pci_disable_device(pci);
                return -ENOMEM;
+       }
        trident->device = (pci->vendor << 16) | pci->device;
        trident->card = card;
        trident->pci = pci;
@@ -3564,6 +3567,7 @@ int __devinit snd_trident_create(snd_card_t * card,
 
        if ((err = pci_request_regions(pci, "Trident Audio")) < 0) {
                kfree(trident);
+               pci_disable_device(pci);
                return err;
        }
        trident->port = pci_resource_start(pci, 0);
@@ -3607,10 +3611,13 @@ int __devinit snd_trident_create(snd_card_t * card,
                return err;
        }
 
-       if ((err = snd_trident_mixer(trident, pcm_spdif_device)) < 0) {
+       if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, trident, &ops)) < 0) {
                snd_trident_free(trident);
                return err;
        }
+
+       if ((err = snd_trident_mixer(trident, pcm_spdif_device)) < 0)
+               return err;
        
        /* initialise synth voices */
        for (i = 0; i < 64; i++) {
@@ -3631,12 +3638,7 @@ int __devinit snd_trident_create(snd_card_t * card,
 
        
        snd_card_set_pm_callback(card, snd_trident_suspend, snd_trident_resume, trident);
-
        snd_trident_proc_init(trident);
-       if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, trident, &ops)) < 0) {
-               snd_trident_free(trident);
-               return err;
-       }
        snd_card_set_dev(card, &pci->dev);
        *rtrident = trident;
        return 0;
@@ -3646,7 +3648,7 @@ int __devinit snd_trident_create(snd_card_t * card,
    snd_trident_free
   
    Description: This routine will free the device specific class for
-            q    the 4DWave card. 
+                the 4DWave card. 
                 
    Paramters:   trident  - device specific private data for 4DWave card
 
@@ -3682,6 +3684,7 @@ int snd_trident_free(trident_t *trident)
        if (trident->irq >= 0)
                free_irq(trident->irq, (void *)trident);
        pci_release_regions(trident->pci);
+       pci_disable_device(trident->pci);
        kfree(trident);
        return 0;
 }
@@ -3949,6 +3952,7 @@ static int snd_trident_suspend(snd_card_t *card, unsigned int state)
        case TRIDENT_DEVICE_ID_SI7018:
                break;
        }
+       pci_disable_device(trident->pci);
        snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
        return 0;
 }