patch-1.3.36 linux/drivers/sound/opl3.c

Next file: linux/drivers/sound/os.h
Previous file: linux/drivers/sound/mpu401.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v1.3.35/linux/drivers/sound/opl3.c linux/drivers/sound/opl3.c
@@ -130,7 +130,7 @@
       {
 	struct sbi_instrument ins;
 
-	memcpy_fromfs (((char *) &ins), &(((char *) arg)[0]), (sizeof (ins)));
+	memcpy_fromfs ((char *) &ins, &(((char *) arg)[0]), sizeof (ins));
 
 	if (ins.channel < 0 || ins.channel >= SBFM_MAXINSTR)
 	  {
@@ -146,7 +146,7 @@
     case SNDCTL_SYNTH_INFO:
       devc->fm_info.nr_voices = (devc->nr_voice == 12) ? 6 : devc->nr_voice;
 
-      memcpy_tofs (&(((char *) arg)[0]), (&devc->fm_info), (sizeof (devc->fm_info)));
+      memcpy_tofs ((&((char *) arg)[0]), &devc->fm_info, sizeof (devc->fm_info));
       return 0;
       break;
 
@@ -186,6 +186,17 @@
   if (devc != NULL)
     return 0;
 
+
+  devc = (struct opl_devinfo *) (sound_mem_blocks[sound_num_blocks] = kmalloc (sizeof (*devc), GFP_KERNEL));
+  if (sound_num_blocks < 1024)
+    sound_num_blocks++;;
+
+  if (devc == NULL)
+    {
+      printk ("OPL3: Can't allocate memory for the device control structure\n");
+      return 0;
+    }
+
   devc->osp = osp;
 
   /* Reset timers 1 and 2 */
@@ -876,7 +887,7 @@
       return -EINVAL;
     }
 
-  memcpy_fromfs ((&((char *) &ins)[offs]), &(((char *) addr)[offs]), (sizeof (ins) - offs));
+  memcpy_fromfs (&((char *) &ins)[offs], &(((char *) addr)[offs]), sizeof (ins) - offs);
 
   if (ins.channel < 0 || ins.channel >= SBFM_MAXINSTR)
     {
@@ -1170,19 +1181,9 @@
       return mem_start;
     }
 
-
-  {
-    caddr_t         ptr;
-
-    ptr = sound_mem_blocks[sound_num_blocks] = kmalloc (sizeof (*devc), GFP_KERNEL);
-    if (sound_num_blocks < 1024)
-      sound_num_blocks++;
-    devc = (struct opl_devinfo *) ptr;
-  };
-
   if (devc == NULL)
     {
-      printk ("OPL3: Can't allocate memory for the device control structure\n");
+      printk ("OPL3: Device control structure not initialized.\n");
       return mem_start;
     }
 

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov with Sam's (original) version
of this