patch-2.4.22 linux-2.4.22/drivers/sound/forte.c

Next file: linux-2.4.22/drivers/sound/hal2.c
Previous file: linux-2.4.22/drivers/sound/esssolo1.c
Back to the patch index
Back to the overall index

diff -urN linux-2.4.21/drivers/sound/forte.c linux-2.4.22/drivers/sound/forte.c
@@ -1945,10 +1945,8 @@
 	      chip->iobase + FORTE_IRQ_STATUS);
 
 	/* Set up the AC97 codec */
-	if ((codec = kmalloc (sizeof (struct ac97_codec), GFP_KERNEL)) == NULL)
+	if ((codec = ac97_alloc_codec()) == NULL)
 		return -ENOMEM;
-	memset (codec, 0, sizeof (struct ac97_codec));
-
 	codec->private_data = chip;
 	codec->codec_read = forte_ac97_read;
 	codec->codec_write = forte_ac97_write;
@@ -1956,7 +1954,7 @@
 
 	if (ac97_probe_codec (codec) == 0) {
 		printk (KERN_ERR PFX "codec probe failed\n");
-		kfree (codec);
+		ac97_release_codec(codec);
 		return -1;
 	}
 
@@ -1964,7 +1962,7 @@
 	if ((codec->dev_mixer = 
 	     register_sound_mixer (&forte_mixer_fops, -1)) < 0) {
 		printk (KERN_ERR PFX "couldn't register mixer!\n");
-		kfree (codec);
+		ac97_release_codec(codec);
 		return -1;
 	}
 
@@ -2092,7 +2090,7 @@
 
 	unregister_sound_dsp (chip->dsp);
 	unregister_sound_mixer (chip->ac97->dev_mixer);
-
+	ac97_release_codec(chip->ac97);
 	kfree (chip);
 
 	printk (KERN_INFO PFX "driver released\n");

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