summaryrefslogtreecommitdiff
path: root/sound/pci
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2005-10-10 13:56:31 +0400
committerJaroslav Kysela <perex@suse.cz>2005-11-04 15:18:00 +0300
commitb1d5776d865951c213a1caaab5d8bf5de7615dbd (patch)
treef999dca30f6e2d03a9176b86c613ae8f4531a6d6 /sound/pci
parent93f2e37840a9a7c3693ca6961fe6ad46b250f3b9 (diff)
downloadlinux-b1d5776d865951c213a1caaab5d8bf5de7615dbd.tar.xz
[ALSA] Remove vmalloc wrapper, kfree_nocheck()
- Remove vmalloc wrapper - Add release_and_free_resource() to remove kfree_nocheck() from each driver and simplify the code Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci')
-rw-r--r--sound/pci/als4000.c6
-rw-r--r--sound/pci/azt3328.c6
-rw-r--r--sound/pci/ca0106/ca0106_main.c6
-rw-r--r--sound/pci/cmipci.c6
-rw-r--r--sound/pci/cs46xx/cs46xx_lib.c5
-rw-r--r--sound/pci/emu10k1/emu10k1x.c6
-rw-r--r--sound/pci/es1968.c6
-rw-r--r--sound/pci/nm256/nm256.c10
-rw-r--r--sound/pci/sonicvibes.c10
-rw-r--r--sound/pci/via82xx.c11
-rw-r--r--sound/pci/ymfpci/ymfpci.c16
-rw-r--r--sound/pci/ymfpci/ymfpci_main.c15
12 files changed, 27 insertions, 76 deletions
diff --git a/sound/pci/als4000.c b/sound/pci/als4000.c
index 196ec1c61bb4..8a32cd92f62a 100644
--- a/sound/pci/als4000.c
+++ b/sound/pci/als4000.c
@@ -594,8 +594,7 @@ static int __devinit snd_als4000_create_gameport(snd_card_als4000_t *acard, int
acard->gameport = gp = gameport_allocate_port();
if (!gp) {
printk(KERN_ERR "als4000: cannot allocate memory for gameport\n");
- release_resource(r);
- kfree_nocheck(r);
+ release_and_free_resource(r);
return -ENOMEM;
}
@@ -622,8 +621,7 @@ static void snd_als4000_free_gameport(snd_card_als4000_t *acard)
acard->gameport = NULL;
snd_als4000_set_addr(acard->gcr, 0, 0, 0, 0); /* disable joystick */
- release_resource(r);
- kfree_nocheck(r);
+ release_and_free_resource(r);
}
}
#else
diff --git a/sound/pci/azt3328.c b/sound/pci/azt3328.c
index d5261bdec583..dc638f395c02 100644
--- a/sound/pci/azt3328.c
+++ b/sound/pci/azt3328.c
@@ -1238,8 +1238,7 @@ static int __devinit snd_azf3328_config_joystick(azf3328_t *chip, int dev)
chip->gameport = gp = gameport_allocate_port();
if (!gp) {
printk(KERN_ERR "azt3328: cannot allocate memory for gameport\n");
- release_resource(r);
- kfree_nocheck(r);
+ release_and_free_resource(r);
return -ENOMEM;
}
@@ -1267,8 +1266,7 @@ static void snd_azf3328_free_joystick(azf3328_t *chip)
/* disable gameport */
snd_azf3328_io2_write(chip, IDX_IO2_LEGACY_ADDR,
snd_azf3328_io2_read(chip, IDX_IO2_LEGACY_ADDR) & ~LEGACY_JOY);
- release_resource(r);
- kfree_nocheck(r);
+ release_and_free_resource(r);
}
}
#else
diff --git a/sound/pci/ca0106/ca0106_main.c b/sound/pci/ca0106/ca0106_main.c
index ba07960921d8..0d9d8923fbbb 100644
--- a/sound/pci/ca0106/ca0106_main.c
+++ b/sound/pci/ca0106/ca0106_main.c
@@ -969,10 +969,8 @@ static int snd_ca0106_free(ca0106_t *chip)
#endif
// release the i/o port
- if (chip->res_port) {
- release_resource(chip->res_port);
- kfree_nocheck(chip->res_port);
- }
+ release_and_free_resource(chip->res_port);
+
// release the irq
if (chip->irq >= 0)
free_irq(chip->irq, (void *)chip);
diff --git a/sound/pci/cmipci.c b/sound/pci/cmipci.c
index 316afb78488d..db093bca2cd0 100644
--- a/sound/pci/cmipci.c
+++ b/sound/pci/cmipci.c
@@ -2683,8 +2683,7 @@ static int __devinit snd_cmipci_create_gameport(cmipci_t *cm, int dev)
cm->gameport = gp = gameport_allocate_port();
if (!gp) {
printk(KERN_ERR "cmipci: cannot allocate memory for gameport\n");
- release_resource(r);
- kfree_nocheck(r);
+ release_and_free_resource(r);
return -ENOMEM;
}
gameport_set_name(gp, "C-Media Gameport");
@@ -2709,8 +2708,7 @@ static void snd_cmipci_free_gameport(cmipci_t *cm)
cm->gameport = NULL;
snd_cmipci_clear_bit(cm, CM_REG_FUNCTRL1, CM_JYSTK_EN);
- release_resource(r);
- kfree_nocheck(r);
+ release_and_free_resource(r);
}
}
#else
diff --git a/sound/pci/cs46xx/cs46xx_lib.c b/sound/pci/cs46xx/cs46xx_lib.c
index 6e3855b8b33d..147836f09dcf 100644
--- a/sound/pci/cs46xx/cs46xx_lib.c
+++ b/sound/pci/cs46xx/cs46xx_lib.c
@@ -2906,10 +2906,7 @@ static int snd_cs46xx_free(cs46xx_t *chip)
snd_cs46xx_region_t *region = &chip->region.idx[idx];
if (region->remap_addr)
iounmap(region->remap_addr);
- if (region->resource) {
- release_resource(region->resource);
- kfree_nocheck(region->resource);
- }
+ release_and_free_resource(region->resource);
}
if (chip->irq >= 0)
free_irq(chip->irq, (void *)chip);
diff --git a/sound/pci/emu10k1/emu10k1x.c b/sound/pci/emu10k1/emu10k1x.c
index ad15755a63c3..cbb689474e7d 100644
--- a/sound/pci/emu10k1/emu10k1x.c
+++ b/sound/pci/emu10k1/emu10k1x.c
@@ -759,10 +759,8 @@ static int snd_emu10k1x_free(emu10k1x_t *chip)
outl(HCFG_LOCKSOUNDCACHE, chip->port + HCFG);
// release the i/o port
- if (chip->res_port) {
- release_resource(chip->res_port);
- kfree_nocheck(chip->res_port);
- }
+ release_and_free_resource(chip->res_port);
+
// release the irq
if (chip->irq >= 0)
free_irq(chip->irq, (void *)chip);
diff --git a/sound/pci/es1968.c b/sound/pci/es1968.c
index ecdcada90ca2..1bf094b67469 100644
--- a/sound/pci/es1968.c
+++ b/sound/pci/es1968.c
@@ -2461,8 +2461,7 @@ static int __devinit snd_es1968_create_gameport(es1968_t *chip, int dev)
chip->gameport = gp = gameport_allocate_port();
if (!gp) {
printk(KERN_ERR "es1968: cannot allocate memory for gameport\n");
- release_resource(r);
- kfree_nocheck(r);
+ release_and_free_resource(r);
return -ENOMEM;
}
@@ -2488,8 +2487,7 @@ static void snd_es1968_free_gameport(es1968_t *chip)
gameport_unregister_port(chip->gameport);
chip->gameport = NULL;
- release_resource(r);
- kfree_nocheck(r);
+ release_and_free_resource(r);
}
}
#else
diff --git a/sound/pci/nm256/nm256.c b/sound/pci/nm256/nm256.c
index 5c55a3b1d121..ebfa38b51128 100644
--- a/sound/pci/nm256/nm256.c
+++ b/sound/pci/nm256/nm256.c
@@ -1347,14 +1347,8 @@ static int snd_nm256_free(nm256_t *chip)
iounmap(chip->cport);
if (chip->buffer)
iounmap(chip->buffer);
- if (chip->res_cport) {
- release_resource(chip->res_cport);
- kfree_nocheck(chip->res_cport);
- }
- if (chip->res_buffer) {
- release_resource(chip->res_buffer);
- kfree_nocheck(chip->res_buffer);
- }
+ release_and_free_resource(chip->res_cport);
+ release_and_free_resource(chip->res_buffer);
if (chip->irq >= 0)
free_irq(chip->irq, (void*)chip);
diff --git a/sound/pci/sonicvibes.c b/sound/pci/sonicvibes.c
index 1f6c2bfd43fd..4f64814dfef0 100644
--- a/sound/pci/sonicvibes.c
+++ b/sound/pci/sonicvibes.c
@@ -1205,14 +1205,8 @@ static int snd_sonicvibes_free(sonicvibes_t *sonic)
pci_write_config_dword(sonic->pci, 0x48, sonic->dmac_port);
if (sonic->irq >= 0)
free_irq(sonic->irq, (void *)sonic);
- if (sonic->res_dmaa) {
- release_resource(sonic->res_dmaa);
- kfree_nocheck(sonic->res_dmaa);
- }
- if (sonic->res_dmac) {
- release_resource(sonic->res_dmac);
- kfree_nocheck(sonic->res_dmac);
- }
+ release_and_free_resource(sonic->res_dmaa);
+ release_and_free_resource(sonic->res_dmac);
pci_release_regions(sonic->pci);
pci_disable_device(sonic->pci);
kfree(sonic);
diff --git a/sound/pci/via82xx.c b/sound/pci/via82xx.c
index b2779fb7d1a9..b0302c369c3d 100644
--- a/sound/pci/via82xx.c
+++ b/sound/pci/via82xx.c
@@ -1655,8 +1655,7 @@ static int __devinit snd_via686_create_gameport(via82xx_t *chip, unsigned char *
chip->gameport = gp = gameport_allocate_port();
if (!gp) {
printk(KERN_ERR "via82xx: cannot allocate memory for gameport\n");
- release_resource(r);
- kfree_nocheck(r);
+ release_and_free_resource(r);
return -ENOMEM;
}
@@ -1682,8 +1681,7 @@ static void snd_via686_free_gameport(via82xx_t *chip)
gameport_unregister_port(chip->gameport);
chip->gameport = NULL;
- release_resource(r);
- kfree_nocheck(r);
+ release_and_free_resource(r);
}
}
#else
@@ -2023,10 +2021,7 @@ static int snd_via82xx_free(via82xx_t *chip)
__end_hw:
if (chip->irq >= 0)
free_irq(chip->irq, (void *)chip);
- if (chip->mpu_res) {
- release_resource(chip->mpu_res);
- kfree_nocheck(chip->mpu_res);
- }
+ release_and_free_resource(chip->mpu_res);
pci_release_regions(chip->pci);
if (chip->chip_type == TYPE_VIA686) {
diff --git a/sound/pci/ymfpci/ymfpci.c b/sound/pci/ymfpci/ymfpci.c
index 2e69abe51aa9..e50d744ae706 100644
--- a/sound/pci/ymfpci/ymfpci.c
+++ b/sound/pci/ymfpci/ymfpci.c
@@ -130,8 +130,7 @@ static int __devinit snd_ymfpci_create_gameport(ymfpci_t *chip, int dev,
chip->gameport = gp = gameport_allocate_port();
if (!gp) {
printk(KERN_ERR "ymfpci: cannot allocate memory for gameport\n");
- release_resource(r);
- kfree_nocheck(r);
+ release_and_free_resource(r);
return -ENOMEM;
}
@@ -161,8 +160,7 @@ void snd_ymfpci_free_gameport(ymfpci_t *chip)
gameport_unregister_port(chip->gameport);
chip->gameport = NULL;
- release_resource(r);
- kfree_nocheck(r);
+ release_and_free_resource(r);
}
}
#else
@@ -267,14 +265,8 @@ static int __devinit snd_card_ymfpci_probe(struct pci_dev *pci,
old_legacy_ctrl,
&chip)) < 0) {
snd_card_free(card);
- if (mpu_res) {
- release_resource(mpu_res);
- kfree_nocheck(mpu_res);
- }
- if (fm_res) {
- release_resource(fm_res);
- kfree_nocheck(fm_res);
- }
+ release_and_free_resource(mpu_res);
+ release_and_free_resource(fm_res);
return err;
}
chip->fm_res = fm_res;
diff --git a/sound/pci/ymfpci/ymfpci_main.c b/sound/pci/ymfpci/ymfpci_main.c
index 2e671ee438c6..c0aaade772d4 100644
--- a/sound/pci/ymfpci/ymfpci_main.c
+++ b/sound/pci/ymfpci/ymfpci_main.c
@@ -2151,14 +2151,8 @@ static int snd_ymfpci_free(ymfpci_t *chip)
#ifdef CONFIG_PM
vfree(chip->saved_regs);
#endif
- if (chip->mpu_res) {
- release_resource(chip->mpu_res);
- kfree_nocheck(chip->mpu_res);
- }
- if (chip->fm_res) {
- release_resource(chip->fm_res);
- kfree_nocheck(chip->fm_res);
- }
+ release_and_free_resource(chip->mpu_res);
+ release_and_free_resource(chip->fm_res);
snd_ymfpci_free_gameport(chip);
if (chip->reg_area_virt)
iounmap(chip->reg_area_virt);
@@ -2167,10 +2161,7 @@ static int snd_ymfpci_free(ymfpci_t *chip)
if (chip->irq >= 0)
free_irq(chip->irq, (void *)chip);
- if (chip->res_reg_area) {
- release_resource(chip->res_reg_area);
- kfree_nocheck(chip->res_reg_area);
- }
+ release_and_free_resource(chip->res_reg_area);
pci_write_config_word(chip->pci, 0x40, chip->old_legacy_ctrl);