patch-2.4.0-test2 linux/drivers/cdrom/aztcd.c

Next file: linux/drivers/cdrom/cdrom.c
Previous file: linux/drivers/block/z2ram.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.0-test1/linux/drivers/cdrom/aztcd.c linux/drivers/cdrom/aztcd.c
@@ -1543,14 +1543,17 @@
 #ifdef AZT_DEBUG
 	printk("aztcd: starting aztcd_open\n");
 #endif
+
 	if (aztPresent == 0)
 		return -ENXIO;                  /* no hardware */
 
+        MOD_INC_USE_COUNT;
+
 	if (!azt_open_count && azt_state == AZT_S_IDLE) 
 	  { azt_invalidate_buffers();
 
 	    st = getAztStatus();                    /* check drive status */
-	    if (st == -1) return -EIO;              /* drive doesn't respond */
+	    if (st == -1) goto err_out;              /* drive doesn't respond */
 
             if (st & AST_DOOR_OPEN)
                { /* close door, then get the status again. */
@@ -1563,18 +1566,20 @@
 	       { printk("aztcd: Disk Changed or No Disk in Drive?\n");
                  aztTocUpToDate=0;
                }
-            if (aztUpdateToc())	return -EIO;
+            if (aztUpdateToc())	goto err_out;
 	       
 	  }
 	++azt_open_count;
-        MOD_INC_USE_COUNT;
 	aztLockDoor();
 
-
 #ifdef AZT_DEBUG
 	printk("aztcd: exiting aztcd_open\n");
 #endif
 	return 0;
+
+err_out:
+	MOD_DEC_USE_COUNT;
+	return -EIO;
 }
 
 
@@ -1786,8 +1791,8 @@
                return -EIO;
 	     }
 	 }
-	devfs_register (NULL, "aztcd", 0, DEVFS_FL_DEFAULT, MAJOR_NR, 0,
-			S_IFBLK | S_IRUGO | S_IWUGO, 0, 0, &azt_fops, NULL);
+	devfs_register (NULL, "aztcd", DEVFS_FL_DEFAULT, MAJOR_NR, 0,
+			S_IFBLK | S_IRUGO | S_IWUGO, &azt_fops, NULL);
 	if (devfs_register_blkdev(MAJOR_NR, "aztcd", &azt_fops) != 0)
 	{
 		printk("aztcd: Unable to get major %d for Aztech CD-ROM\n",

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