Merge branch 'topic/pcsp-fix' into topic/misc
authorTakashi Iwai <tiwai@suse.de>
Sat, 20 Dec 2008 22:39:47 +0000 (23:39 +0100)
committerTakashi Iwai <tiwai@suse.de>
Sat, 20 Dec 2008 22:39:47 +0000 (23:39 +0100)
1  2 
sound/pci/mixart/mixart.c
sound/pci/pcxhr/pcxhr.c

@@@ -1010,7 -1010,7 +1010,7 @@@ static int __devinit snd_mixart_create(
                .dev_free = snd_mixart_chip_dev_free,
        };
  
 -      mgr->chip[idx] = chip = kzalloc(sizeof(*chip), GFP_KERNEL);
 +      chip = kzalloc(sizeof(*chip), GFP_KERNEL);
        if (! chip) {
                snd_printk(KERN_ERR "cannot allocate chip\n");
                return -ENOMEM;
                return err;
        }
  
 +      mgr->chip[idx] = chip;
        snd_card_set_dev(card, &mgr->pci->dev);
  
        return 0;
@@@ -1315,8 -1314,7 +1315,7 @@@ static int __devinit snd_mixart_probe(s
        }
        for (i = 0; i < 2; i++) {
                mgr->mem[i].phys = pci_resource_start(pci, i);
-               mgr->mem[i].virt = ioremap_nocache(mgr->mem[i].phys,
-                                                  pci_resource_len(pci, i));
+               mgr->mem[i].virt = pci_ioremap_bar(pci, i);
                if (!mgr->mem[i].virt) {
                        printk(KERN_ERR "unable to remap resource 0x%lx\n",
                               mgr->mem[i].phys);
                sprintf(card->longname, "%s [PCM #%d]", mgr->longname, i);
  
                if ((err = snd_mixart_create(mgr, card, i)) < 0) {
 +                      snd_card_free(card);
                        snd_mixart_free(mgr);
                        return err;
                }
diff --combined sound/pci/pcxhr/pcxhr.c
@@@ -1024,7 -1024,7 +1024,7 @@@ static int __devinit pcxhr_create(struc
                .dev_free = pcxhr_chip_dev_free,
        };
  
 -      mgr->chip[idx] = chip = kzalloc(sizeof(*chip), GFP_KERNEL);
 +      chip = kzalloc(sizeof(*chip), GFP_KERNEL);
        if (! chip) {
                snd_printk(KERN_ERR "cannot allocate chip\n");
                return -ENOMEM;
                return err;
        }
  
 +      mgr->chip[idx] = chip;
        snd_card_set_dev(card, &mgr->pci->dev);
  
        return 0;
@@@ -1230,8 -1229,11 +1230,11 @@@ static int __devinit pcxhr_probe(struc
                return -ENOMEM;
        }
  
-       if (snd_BUG_ON(pci_id->driver_data >= PCI_ID_LAST))
+       if (snd_BUG_ON(pci_id->driver_data >= PCI_ID_LAST)) {
+               kfree(mgr);
+               pci_disable_device(pci);
                return -ENODEV;
+       }
        card_name = pcxhr_board_params[pci_id->driver_data].board_name;
        mgr->playback_chips = pcxhr_board_params[pci_id->driver_data].playback_chips;
        mgr->capture_chips  = pcxhr_board_params[pci_id->driver_data].capture_chips;
                sprintf(card->longname, "%s [PCM #%d]", mgr->longname, i);
  
                if ((err = pcxhr_create(mgr, card, i)) < 0) {
 +                      snd_card_free(card);
                        pcxhr_free(mgr);
                        return err;
                }