]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - sound/pcmcia/pdaudiocf/pdaudiocf.c
Merge git://git.kernel.org/pub/scm/linux/kernel/git/lethal/sh-2.6
[linux-2.6-omap-h63xx.git] / sound / pcmcia / pdaudiocf / pdaudiocf.c
index de683b08fe03af6b8b3527f292699f2ee9f12c5f..7dea74b71cf1ab8e1485a85b4e3f35b658a7b639 100644 (file)
@@ -18,7 +18,6 @@
  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
  */
 
-#include <sound/driver.h>
 #include <sound/core.h>
 #include <linux/slab.h>
 #include <linux/moduleparam.h>
@@ -92,7 +91,7 @@ static int snd_pdacf_dev_free(struct snd_device *device)
  */
 static int snd_pdacf_probe(struct pcmcia_device *link)
 {
-       int i;
+       int i, err;
        struct snd_pdacf *pdacf;
        struct snd_card *card;
        static struct snd_device_ops ops = {
@@ -113,22 +112,27 @@ static int snd_pdacf_probe(struct pcmcia_device *link)
                return -ENODEV; /* disabled explicitly */
 
        /* ok, create a card instance */
-       card = snd_card_new(index[i], id[i], THIS_MODULE, 0);
-       if (card == NULL) {
+       err = snd_card_create(index[i], id[i], THIS_MODULE, 0, &card);
+       if (err < 0) {
                snd_printk(KERN_ERR "pdacf: cannot create a card instance\n");
-               return -ENOMEM;
+               return err;
        }
 
        pdacf = snd_pdacf_create(card);
-       if (! pdacf)
-               return -EIO;
+       if (!pdacf) {
+               snd_card_free(card);
+               return -ENOMEM;
+       }
 
-       if (snd_device_new(card, SNDRV_DEV_LOWLEVEL, pdacf, &ops) < 0) {
+       err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, pdacf, &ops);
+       if (err < 0) {
                kfree(pdacf);
                snd_card_free(card);
-               return -ENODEV;
+               return err;
        }
 
+       snd_card_set_dev(card, &handle_to_dev(link));
+
        pdacf->index = i;
        card_list[i] = card;