diff options
Diffstat (limited to 'drivers/ide/ide-cd.c')
-rw-r--r-- | drivers/ide/ide-cd.c | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c index e6e350cdfbf9..624d48841533 100644 --- a/drivers/ide/ide-cd.c +++ b/drivers/ide/ide-cd.c | |||
@@ -3353,21 +3353,16 @@ static int idecd_open(struct inode * inode, struct file * file) | |||
3353 | { | 3353 | { |
3354 | struct gendisk *disk = inode->i_bdev->bd_disk; | 3354 | struct gendisk *disk = inode->i_bdev->bd_disk; |
3355 | struct cdrom_info *info; | 3355 | struct cdrom_info *info; |
3356 | ide_drive_t *drive; | ||
3357 | int rc = -ENOMEM; | 3356 | int rc = -ENOMEM; |
3358 | 3357 | ||
3359 | if (!(info = ide_cd_get(disk))) | 3358 | if (!(info = ide_cd_get(disk))) |
3360 | return -ENXIO; | 3359 | return -ENXIO; |
3361 | 3360 | ||
3362 | drive = info->drive; | ||
3363 | |||
3364 | drive->usage++; | ||
3365 | |||
3366 | if (!info->buffer) | 3361 | if (!info->buffer) |
3367 | info->buffer = kmalloc(SECTOR_BUFFER_SIZE, | 3362 | info->buffer = kmalloc(SECTOR_BUFFER_SIZE, GFP_KERNEL|__GFP_REPEAT); |
3368 | GFP_KERNEL|__GFP_REPEAT); | 3363 | |
3369 | if (!info->buffer || (rc = cdrom_open(&info->devinfo, inode, file))) | 3364 | if (info->buffer) |
3370 | drive->usage--; | 3365 | rc = cdrom_open(&info->devinfo, inode, file); |
3371 | 3366 | ||
3372 | if (rc < 0) | 3367 | if (rc < 0) |
3373 | ide_cd_put(info); | 3368 | ide_cd_put(info); |
@@ -3379,10 +3374,8 @@ static int idecd_release(struct inode * inode, struct file * file) | |||
3379 | { | 3374 | { |
3380 | struct gendisk *disk = inode->i_bdev->bd_disk; | 3375 | struct gendisk *disk = inode->i_bdev->bd_disk; |
3381 | struct cdrom_info *info = ide_cd_g(disk); | 3376 | struct cdrom_info *info = ide_cd_g(disk); |
3382 | ide_drive_t *drive = info->drive; | ||
3383 | 3377 | ||
3384 | cdrom_release (&info->devinfo, file); | 3378 | cdrom_release (&info->devinfo, file); |
3385 | drive->usage--; | ||
3386 | 3379 | ||
3387 | ide_cd_put(info); | 3380 | ide_cd_put(info); |
3388 | 3381 | ||