patch-2.3.7 linux/drivers/sound/vidc.c

Next file: linux/drivers/sound/vidc_audio.c
Previous file: linux/drivers/sound/sonicvibes.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.6/linux/drivers/sound/vidc.c linux/drivers/sound/vidc.c
@@ -24,7 +24,7 @@
 #define TYPE(fmt,ch) (((fmt)<<2) | ((ch)&3))
 
 	fillertype = TYPE(format, channels);
-printk("filler type: %X\n", fillertype);
+
 	switch (fillertype)
 	{
 		default:
@@ -61,10 +61,13 @@
 
 	sprintf(name, "VIDC %d-bit sound", hw_config->card_subtype);
 	conf_printf(name, hw_config);
+	memset(dma_buf, 0, sizeof(dma_buf));
 
 	for (i = 0; i < 2; i++)
 	{
 		dma_buf[i] = get_free_page(GFP_KERNEL);
+		if (!dma_buf[i])
+			goto nomem;
 		dma_pbuf[i] = virt_to_phys(dma_buf[i]);
 	}
 
@@ -78,9 +81,16 @@
 		printk(KERN_ERR "VIDCsound: can't allocate DMA interrupt\n");
 		return;
 	}
+
 //	vidc_synth_init(hw_config);
 	vidc_audio_init(hw_config);
 	vidc_mixer_init(hw_config);
+	return;
+
+nomem:
+	for (i = 0; i < 2; i++)
+		free_page(dma_buf[i]);
+	printk(KERN_ERR "VIDCsound: can't allocate required buffers\n");
 }
 
 int probe_vidc(struct address_info *hw_config)

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)