]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/media/video/cx88/cx88-alsa.c
V4L/DVB (10943): cx88: Prevent general protection fault on rmmod
[linux-2.6-omap-h63xx.git] / drivers / media / video / cx88 / cx88-alsa.c
index 80c8883e54b5c6ef853d5e8560da3424044376e3..ce98d955231ae4f505b8e018836698d33a3ebde8 100644 (file)
@@ -82,7 +82,6 @@ typedef struct cx88_audio_dev snd_cx88_card_t;
 
 
 
-
 /****************************************************************************
                        Module global static vars
  ****************************************************************************/
@@ -743,7 +742,6 @@ static int __devinit snd_cx88_create(struct snd_card *card,
        core = cx88_core_get(pci);
        if (NULL == core) {
                err = -EINVAL;
-               kfree (chip);
                return err;
        }
 
@@ -805,15 +803,16 @@ static int __devinit cx88_audio_initdev(struct pci_dev *pci,
                return (-ENOENT);
        }
 
-       card = snd_card_new(index[devno], id[devno], THIS_MODULE, sizeof(snd_cx88_card_t));
-       if (!card)
-               return (-ENOMEM);
+       err = snd_card_create(index[devno], id[devno], THIS_MODULE,
+                             sizeof(snd_cx88_card_t), &card);
+       if (err < 0)
+               return err;
 
        card->private_free = snd_cx88_dev_free;
 
        err = snd_cx88_create(card, pci, &chip);
        if (err < 0)
-               return (err);
+               goto error;
 
        err = snd_cx88_pcm(chip, 0, "CX88 Digital");
        if (err < 0)