Merge branch 'topic/usb-caiaq' into for-linus
[linux-2.6.git] / sound / usb / caiaq / caiaq-device.c
index 771c523..cf573a9 100644 (file)
@@ -356,9 +356,10 @@ static void __devinit setup_card(struct snd_usb_caiaqdev *dev)
                log("Unable to set up control system (ret=%d)\n", ret);
 }
 
-static struct snd_card* create_card(struct usb_device* usb_dev)
+static int create_card(struct usb_device* usb_dev, struct snd_card **cardp)
 {
        int devnum;
+       int err;
        struct snd_card *card;
        struct snd_usb_caiaqdev *dev;
 
@@ -367,12 +368,12 @@ static struct snd_card* create_card(struct usb_device* usb_dev)
                        break;
 
        if (devnum >= SNDRV_CARDS)
-               return NULL;
+               return -ENODEV;
 
-       card = snd_card_new(index[devnum], id[devnum], THIS_MODULE, 
-                                       sizeof(struct snd_usb_caiaqdev));
-       if (!card)
-               return NULL;
+       err = snd_card_create(index[devnum], id[devnum], THIS_MODULE, 
+                             sizeof(struct snd_usb_caiaqdev), &card);
+       if (err < 0)
+               return err;
 
        dev = caiaqdev(card);
        dev->chip.dev = usb_dev;
@@ -382,7 +383,8 @@ static struct snd_card* create_card(struct usb_device* usb_dev)
        spin_lock_init(&dev->spinlock);
        snd_card_set_dev(card, &usb_dev->dev);
 
-       return card;
+       *cardp = card;
+       return 0;
 }
 
 static int __devinit init_card(struct snd_usb_caiaqdev *dev)
@@ -461,10 +463,10 @@ static int __devinit snd_probe(struct usb_interface *intf,
        struct snd_card *card;
        struct usb_device *device = interface_to_usbdev(intf);
        
-       card = create_card(device);
+       ret = create_card(device, &card);
        
-       if (!card)
-               return -ENOMEM;
+       if (ret < 0)
+               return ret;
                        
        usb_set_intfdata(intf, card);
        ret = init_card(caiaqdev(card));