aboutsummaryrefslogtreecommitdiffstats
path: root/sound/oss
diff options
context:
space:
mode:
Diffstat (limited to 'sound/oss')
-rw-r--r--sound/oss/cs4232.c15
-rw-r--r--sound/oss/dmasound/dmasound_awacs.c2
-rw-r--r--sound/oss/emu10k1/midi.c9
-rw-r--r--sound/oss/esssolo1.c2
-rw-r--r--sound/oss/maestro3.c10
-rw-r--r--sound/oss/msnd.c6
-rw-r--r--sound/oss/sb_card.c35
-rw-r--r--sound/oss/sequencer.c13
-rw-r--r--sound/oss/sh_dac_audio.c2
-rw-r--r--sound/oss/sonicvibes.c3
10 files changed, 50 insertions, 47 deletions
diff --git a/sound/oss/cs4232.c b/sound/oss/cs4232.c
index 7c59e2d4003a..c7f86f09c28d 100644
--- a/sound/oss/cs4232.c
+++ b/sound/oss/cs4232.c
@@ -360,6 +360,8 @@ static int __initdata synthio = -1;
360static int __initdata synthirq = -1; 360static int __initdata synthirq = -1;
361static int __initdata isapnp = 1; 361static int __initdata isapnp = 1;
362 362
363static unsigned int cs4232_devices;
364
363MODULE_DESCRIPTION("CS4232 based soundcard driver"); 365MODULE_DESCRIPTION("CS4232 based soundcard driver");
364MODULE_AUTHOR("Hannu Savolainen, Paul Barton-Davis"); 366MODULE_AUTHOR("Hannu Savolainen, Paul Barton-Davis");
365MODULE_LICENSE("GPL"); 367MODULE_LICENSE("GPL");
@@ -421,6 +423,7 @@ static int cs4232_pnp_probe(struct pnp_dev *dev, const struct pnp_device_id *dev
421 return -ENODEV; 423 return -ENODEV;
422 } 424 }
423 pnp_set_drvdata(dev,isapnpcfg); 425 pnp_set_drvdata(dev,isapnpcfg);
426 cs4232_devices++;
424 return 0; 427 return 0;
425} 428}
426 429
@@ -455,10 +458,11 @@ static int __init init_cs4232(void)
455#endif 458#endif
456 cfg.irq = -1; 459 cfg.irq = -1;
457 460
458 if (isapnp && 461 if (isapnp) {
459 (pnp_register_driver(&cs4232_driver) > 0) 462 pnp_register_driver(&cs4232_driver);
460 ) 463 if (cs4232_devices)
461 return 0; 464 return 0;
465 }
462 466
463 if(io==-1||irq==-1||dma==-1) 467 if(io==-1||irq==-1||dma==-1)
464 { 468 {
@@ -503,7 +507,8 @@ static int __init setup_cs4232(char *str)
503 int ints[7]; 507 int ints[7];
504 508
505 /* If we have isapnp cards, no need for options */ 509 /* If we have isapnp cards, no need for options */
506 if (pnp_register_driver(&cs4232_driver) > 0) 510 pnp_register_driver(&cs4232_driver);
511 if (cs4232_devices)
507 return 1; 512 return 1;
508 513
509 str = get_options(str, ARRAY_SIZE(ints), ints); 514 str = get_options(str, ARRAY_SIZE(ints), ints);
diff --git a/sound/oss/dmasound/dmasound_awacs.c b/sound/oss/dmasound/dmasound_awacs.c
index a8636adef2e6..c8e210326893 100644
--- a/sound/oss/dmasound/dmasound_awacs.c
+++ b/sound/oss/dmasound/dmasound_awacs.c
@@ -2798,7 +2798,7 @@ __init setup_beep(void)
2798 DBDMA_ALIGN(beep_dbdma_cmd_space); 2798 DBDMA_ALIGN(beep_dbdma_cmd_space);
2799 /* set up emergency dbdma cmd */ 2799 /* set up emergency dbdma cmd */
2800 emergency_dbdma_cmd = beep_dbdma_cmd+1 ; 2800 emergency_dbdma_cmd = beep_dbdma_cmd+1 ;
2801 beep_buf = (short *) kmalloc(BEEP_BUFLEN * 4, GFP_KERNEL); 2801 beep_buf = kmalloc(BEEP_BUFLEN * 4, GFP_KERNEL);
2802 if (beep_buf == NULL) { 2802 if (beep_buf == NULL) {
2803 printk(KERN_ERR "dmasound_pmac: no memory for beep buffer\n"); 2803 printk(KERN_ERR "dmasound_pmac: no memory for beep buffer\n");
2804 kfree(beep_dbdma_cmd_space) ; 2804 kfree(beep_dbdma_cmd_space) ;
diff --git a/sound/oss/emu10k1/midi.c b/sound/oss/emu10k1/midi.c
index 959a96794dba..25ae8e4a488d 100644
--- a/sound/oss/emu10k1/midi.c
+++ b/sound/oss/emu10k1/midi.c
@@ -65,7 +65,8 @@ static int midiin_add_buffer(struct emu10k1_mididevice *midi_dev, struct midi_hd
65 65
66 init_midi_hdr(midihdr); 66 init_midi_hdr(midihdr);
67 67
68 if ((midihdr->data = (u8 *) kmalloc(MIDIIN_BUFLEN, GFP_KERNEL)) == NULL) { 68 midihdr->data = kmalloc(MIDIIN_BUFLEN, GFP_KERNEL);
69 if (!midihdr->data) {
69 ERROR(); 70 ERROR();
70 kfree(midihdr); 71 kfree(midihdr);
71 return -1; 72 return -1;
@@ -334,7 +335,8 @@ static ssize_t emu10k1_midi_write(struct file *file, const char __user *buffer,
334 midihdr->bytesrecorded = 0; 335 midihdr->bytesrecorded = 0;
335 midihdr->flags = 0; 336 midihdr->flags = 0;
336 337
337 if ((midihdr->data = (u8 *) kmalloc(count, GFP_KERNEL)) == NULL) { 338 midihdr->data = kmalloc(count, GFP_KERNEL);
339 if (!midihdr->data) {
338 ERROR(); 340 ERROR();
339 kfree(midihdr); 341 kfree(midihdr);
340 return -EINVAL; 342 return -EINVAL;
@@ -545,7 +547,8 @@ int emu10k1_seq_midi_out(int dev, unsigned char midi_byte)
545 midihdr->bytesrecorded = 0; 547 midihdr->bytesrecorded = 0;
546 midihdr->flags = 0; 548 midihdr->flags = 0;
547 549
548 if ((midihdr->data = (u8 *) kmalloc(1, GFP_KERNEL)) == NULL) { 550 midihdr->data = kmalloc(1, GFP_KERNEL);
551 if (!midihdr->data) {
549 ERROR(); 552 ERROR();
550 kfree(midihdr); 553 kfree(midihdr);
551 return -EINVAL; 554 return -EINVAL;
diff --git a/sound/oss/esssolo1.c b/sound/oss/esssolo1.c
index 78d3e29ce968..6861563d7525 100644
--- a/sound/oss/esssolo1.c
+++ b/sound/oss/esssolo1.c
@@ -2348,7 +2348,7 @@ static int __devinit solo1_probe(struct pci_dev *pcidev, const struct pci_device
2348 /* Recording requires 24-bit DMA, so attempt to set dma mask 2348 /* Recording requires 24-bit DMA, so attempt to set dma mask
2349 * to 24 bits first, then 32 bits (playback only) if that fails. 2349 * to 24 bits first, then 32 bits (playback only) if that fails.
2350 */ 2350 */
2351 if (pci_set_dma_mask(pcidev, 0x00ffffff) && 2351 if (pci_set_dma_mask(pcidev, DMA_24BIT_MASK) &&
2352 pci_set_dma_mask(pcidev, DMA_32BIT_MASK)) { 2352 pci_set_dma_mask(pcidev, DMA_32BIT_MASK)) {
2353 printk(KERN_WARNING "solo1: architecture does not support 24bit or 32bit PCI busmaster DMA\n"); 2353 printk(KERN_WARNING "solo1: architecture does not support 24bit or 32bit PCI busmaster DMA\n");
2354 return -ENODEV; 2354 return -ENODEV;
diff --git a/sound/oss/maestro3.c b/sound/oss/maestro3.c
index 66044aff2586..4a5e4237a110 100644
--- a/sound/oss/maestro3.c
+++ b/sound/oss/maestro3.c
@@ -2582,15 +2582,9 @@ static int alloc_dsp_suspendmem(struct m3_card *card)
2582 2582
2583 return 0; 2583 return 0;
2584} 2584}
2585static void free_dsp_suspendmem(struct m3_card *card)
2586{
2587 if(card->suspend_mem)
2588 vfree(card->suspend_mem);
2589}
2590 2585
2591#else 2586#else
2592#define alloc_dsp_suspendmem(args...) 0 2587#define alloc_dsp_suspendmem(args...) 0
2593#define free_dsp_suspendmem(args...)
2594#endif 2588#endif
2595 2589
2596/* 2590/*
@@ -2717,7 +2711,7 @@ out:
2717 if(ret) { 2711 if(ret) {
2718 if(card->iobase) 2712 if(card->iobase)
2719 release_region(pci_resource_start(pci_dev, 0), pci_resource_len(pci_dev, 0)); 2713 release_region(pci_resource_start(pci_dev, 0), pci_resource_len(pci_dev, 0));
2720 free_dsp_suspendmem(card); 2714 vfree(card->suspend_mem);
2721 if(card->ac97) { 2715 if(card->ac97) {
2722 unregister_sound_mixer(card->ac97->dev_mixer); 2716 unregister_sound_mixer(card->ac97->dev_mixer);
2723 kfree(card->ac97); 2717 kfree(card->ac97);
@@ -2760,7 +2754,7 @@ static void m3_remove(struct pci_dev *pci_dev)
2760 } 2754 }
2761 2755
2762 release_region(card->iobase, 256); 2756 release_region(card->iobase, 256);
2763 free_dsp_suspendmem(card); 2757 vfree(card->suspend_mem);
2764 kfree(card); 2758 kfree(card);
2765 } 2759 }
2766 devs = NULL; 2760 devs = NULL;
diff --git a/sound/oss/msnd.c b/sound/oss/msnd.c
index a7ad2b0a2ac0..5dbfc0f9c3c7 100644
--- a/sound/oss/msnd.c
+++ b/sound/oss/msnd.c
@@ -95,10 +95,8 @@ void msnd_fifo_init(msnd_fifo *f)
95 95
96void msnd_fifo_free(msnd_fifo *f) 96void msnd_fifo_free(msnd_fifo *f)
97{ 97{
98 if (f->data) { 98 vfree(f->data);
99 vfree(f->data); 99 f->data = NULL;
100 f->data = NULL;
101 }
102} 100}
103 101
104int msnd_fifo_alloc(msnd_fifo *f, size_t n) 102int msnd_fifo_alloc(msnd_fifo *f, size_t n)
diff --git a/sound/oss/sb_card.c b/sound/oss/sb_card.c
index 680b82e15298..4708cbdc3149 100644
--- a/sound/oss/sb_card.c
+++ b/sound/oss/sb_card.c
@@ -52,6 +52,7 @@ static int __initdata sm_games = 0; /* Logitech soundman games? */
52static struct sb_card_config *legacy = NULL; 52static struct sb_card_config *legacy = NULL;
53 53
54#ifdef CONFIG_PNP 54#ifdef CONFIG_PNP
55static int pnp_registered;
55static int __initdata pnp = 1; 56static int __initdata pnp = 1;
56/* 57/*
57static int __initdata uart401 = 0; 58static int __initdata uart401 = 0;
@@ -133,7 +134,7 @@ static void sb_unload(struct sb_card_config *scc)
133} 134}
134 135
135/* Register legacy card with OSS subsystem */ 136/* Register legacy card with OSS subsystem */
136static int sb_init_legacy(void) 137static int __init sb_init_legacy(void)
137{ 138{
138 struct sb_module_options sbmo = {0}; 139 struct sb_module_options sbmo = {0};
139 140
@@ -234,6 +235,8 @@ static void sb_dev2cfg(struct pnp_dev *dev, struct sb_card_config *scc)
234 } 235 }
235} 236}
236 237
238static unsigned int sb_pnp_devices;
239
237/* Probe callback function for the PnP API */ 240/* Probe callback function for the PnP API */
238static int sb_pnp_probe(struct pnp_card_link *card, const struct pnp_card_device_id *card_id) 241static int sb_pnp_probe(struct pnp_card_link *card, const struct pnp_card_device_id *card_id)
239{ 242{
@@ -264,6 +267,7 @@ static int sb_pnp_probe(struct pnp_card_link *card, const struct pnp_card_device
264 scc->conf.dma, scc->conf.dma2); 267 scc->conf.dma, scc->conf.dma2);
265 268
266 pnp_set_card_drvdata(card, scc); 269 pnp_set_card_drvdata(card, scc);
270 sb_pnp_devices++;
267 271
268 return sb_register_oss(scc, &sbmo); 272 return sb_register_oss(scc, &sbmo);
269} 273}
@@ -289,6 +293,14 @@ static struct pnp_card_driver sb_pnp_driver = {
289MODULE_DEVICE_TABLE(pnp_card, sb_pnp_card_table); 293MODULE_DEVICE_TABLE(pnp_card, sb_pnp_card_table);
290#endif /* CONFIG_PNP */ 294#endif /* CONFIG_PNP */
291 295
296static void __init_or_module sb_unregister_all(void)
297{
298#ifdef CONFIG_PNP
299 if (pnp_registered)
300 pnp_unregister_card_driver(&sb_pnp_driver);
301#endif
302}
303
292static int __init sb_init(void) 304static int __init sb_init(void)
293{ 305{
294 int lres = 0; 306 int lres = 0;
@@ -307,17 +319,18 @@ static int __init sb_init(void)
307 319
308#ifdef CONFIG_PNP 320#ifdef CONFIG_PNP
309 if(pnp) { 321 if(pnp) {
310 pres = pnp_register_card_driver(&sb_pnp_driver); 322 int err = pnp_register_card_driver(&sb_pnp_driver);
323 if (!err)
324 pnp_registered = 1;
325 pres = sb_pnp_devices;
311 } 326 }
312#endif 327#endif
313 printk(KERN_INFO "sb: Init: Done\n"); 328 printk(KERN_INFO "sb: Init: Done\n");
314 329
315 /* If either PnP or Legacy registered a card then return 330 /* If either PnP or Legacy registered a card then return
316 * success */ 331 * success */
317 if (pres <= 0 && lres <= 0) { 332 if (pres == 0 && lres <= 0) {
318#ifdef CONFIG_PNP 333 sb_unregister_all();
319 pnp_unregister_card_driver(&sb_pnp_driver);
320#endif
321 return -ENODEV; 334 return -ENODEV;
322 } 335 }
323 return 0; 336 return 0;
@@ -333,14 +346,10 @@ static void __exit sb_exit(void)
333 sb_unload(legacy); 346 sb_unload(legacy);
334 } 347 }
335 348
336#ifdef CONFIG_PNP 349 sb_unregister_all();
337 pnp_unregister_card_driver(&sb_pnp_driver);
338#endif
339 350
340 if (smw_free) { 351 vfree(smw_free);
341 vfree(smw_free); 352 smw_free = NULL;
342 smw_free = NULL;
343 }
344} 353}
345 354
346module_init(sb_init); 355module_init(sb_init);
diff --git a/sound/oss/sequencer.c b/sound/oss/sequencer.c
index 347cd79c2502..6815c30e0bc1 100644
--- a/sound/oss/sequencer.c
+++ b/sound/oss/sequencer.c
@@ -1671,14 +1671,7 @@ void sequencer_init(void)
1671 1671
1672void sequencer_unload(void) 1672void sequencer_unload(void)
1673{ 1673{
1674 if(queue) 1674 vfree(queue);
1675 { 1675 vfree(iqueue);
1676 vfree(queue); 1676 queue = iqueue = NULL;
1677 queue=NULL;
1678 }
1679 if(iqueue)
1680 {
1681 vfree(iqueue);
1682 iqueue=NULL;
1683 }
1684} 1677}
diff --git a/sound/oss/sh_dac_audio.c b/sound/oss/sh_dac_audio.c
index 8a9917c919c2..3f7427cd195a 100644
--- a/sound/oss/sh_dac_audio.c
+++ b/sound/oss/sh_dac_audio.c
@@ -289,7 +289,7 @@ static int __init dac_audio_init(void)
289 289
290 in_use = 0; 290 in_use = 0;
291 291
292 data_buffer = (char *)kmalloc(BUFFER_SIZE, GFP_KERNEL); 292 data_buffer = kmalloc(BUFFER_SIZE, GFP_KERNEL);
293 if (data_buffer == NULL) 293 if (data_buffer == NULL)
294 return -ENOMEM; 294 return -ENOMEM;
295 295
diff --git a/sound/oss/sonicvibes.c b/sound/oss/sonicvibes.c
index 4471757b7985..42bd276cfc39 100644
--- a/sound/oss/sonicvibes.c
+++ b/sound/oss/sonicvibes.c
@@ -116,6 +116,7 @@
116#include <linux/spinlock.h> 116#include <linux/spinlock.h>
117#include <linux/smp_lock.h> 117#include <linux/smp_lock.h>
118#include <linux/gameport.h> 118#include <linux/gameport.h>
119#include <linux/dma-mapping.h>
119#include <linux/mutex.h> 120#include <linux/mutex.h>
120 121
121 122
@@ -2535,7 +2536,7 @@ static int __devinit sv_probe(struct pci_dev *pcidev, const struct pci_device_id
2535 return -ENODEV; 2536 return -ENODEV;
2536 if (pcidev->irq == 0) 2537 if (pcidev->irq == 0)
2537 return -ENODEV; 2538 return -ENODEV;
2538 if (pci_set_dma_mask(pcidev, 0x00ffffff)) { 2539 if (pci_set_dma_mask(pcidev, DMA_24BIT_MASK)) {
2539 printk(KERN_WARNING "sonicvibes: architecture does not support 24bit PCI busmaster DMA\n"); 2540 printk(KERN_WARNING "sonicvibes: architecture does not support 24bit PCI busmaster DMA\n");
2540 return -ENODEV; 2541 return -ENODEV;
2541 } 2542 }