aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci
diff options
context:
space:
mode:
Diffstat (limited to 'sound/pci')
-rw-r--r--sound/pci/oxygen/oxygen_lib.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/sound/pci/oxygen/oxygen_lib.c b/sound/pci/oxygen/oxygen_lib.c
index b5560fa5a5e3..228f30800fd9 100644
--- a/sound/pci/oxygen/oxygen_lib.c
+++ b/sound/pci/oxygen/oxygen_lib.c
@@ -446,6 +446,7 @@ static void oxygen_card_free(struct snd_card *card)
446 free_irq(chip->irq, chip); 446 free_irq(chip->irq, chip);
447 flush_scheduled_work(); 447 flush_scheduled_work();
448 chip->model.cleanup(chip); 448 chip->model.cleanup(chip);
449 kfree(chip->model_data);
449 mutex_destroy(&chip->mutex); 450 mutex_destroy(&chip->mutex);
450 pci_release_regions(chip->pci); 451 pci_release_regions(chip->pci);
451 pci_disable_device(chip->pci); 452 pci_disable_device(chip->pci);
@@ -460,8 +461,7 @@ int oxygen_pci_probe(struct pci_dev *pci, int index, char *id,
460 struct oxygen *chip; 461 struct oxygen *chip;
461 int err; 462 int err;
462 463
463 err = snd_card_create(index, id, owner, 464 err = snd_card_create(index, id, owner, sizeof(*chip), &card);
464 sizeof(*chip) + model->model_data_size, &card);
465 if (err < 0) 465 if (err < 0)
466 return err; 466 return err;
467 467
@@ -470,7 +470,6 @@ int oxygen_pci_probe(struct pci_dev *pci, int index, char *id,
470 chip->pci = pci; 470 chip->pci = pci;
471 chip->irq = -1; 471 chip->irq = -1;
472 chip->model = *model; 472 chip->model = *model;
473 chip->model_data = chip + 1;
474 spin_lock_init(&chip->reg_lock); 473 spin_lock_init(&chip->reg_lock);
475 mutex_init(&chip->mutex); 474 mutex_init(&chip->mutex);
476 INIT_WORK(&chip->spdif_input_bits_work, 475 INIT_WORK(&chip->spdif_input_bits_work,
@@ -496,6 +495,15 @@ int oxygen_pci_probe(struct pci_dev *pci, int index, char *id,
496 } 495 }
497 chip->addr = pci_resource_start(pci, 0); 496 chip->addr = pci_resource_start(pci, 0);
498 497
498 if (chip->model.model_data_size) {
499 chip->model_data = kmalloc(chip->model.model_data_size,
500 GFP_KERNEL);
501 if (!chip->model_data) {
502 err = -ENOMEM;
503 goto err_pci_regions;
504 }
505 }
506
499 pci_set_master(pci); 507 pci_set_master(pci);
500 snd_card_set_dev(card, &pci->dev); 508 snd_card_set_dev(card, &pci->dev);
501 card->private_free = oxygen_card_free; 509 card->private_free = oxygen_card_free;