patch-2.4.5 linux/drivers/ide/ide-cd.c

Next file: linux/drivers/ide/ide-pci.c
Previous file: linux/drivers/ide/hpt366.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.4/linux/drivers/ide/ide-cd.c linux/drivers/ide/ide-cd.c
@@ -2780,12 +2780,12 @@
 int ide_cdrom_open (struct inode *ip, struct file *fp, ide_drive_t *drive)
 {
 	struct cdrom_info *info = drive->driver_data;
-	int rc;
+	int rc = -ENOMEM;
 
 	MOD_INC_USE_COUNT;
 	if (info->buffer == NULL)
 		info->buffer = (char *) kmalloc(SECTOR_BUFFER_SIZE, GFP_KERNEL);
-	if ((rc = cdrom_fops.open(ip, fp))) {
+	if ((info->buffer == NULL) || (rc = cdrom_fops.open(ip, fp))) {
 		drive->usage--;
 		MOD_DEC_USE_COUNT;
 	}

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