aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/ide-cd.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ide/ide-cd.c')
-rw-r--r--drivers/ide/ide-cd.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index bf9f61a5c2f8..5108e9739c96 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -1591,17 +1591,19 @@ static struct ide_driver ide_cdrom_driver = {
1591 1591
1592static int idecd_open(struct block_device *bdev, fmode_t mode) 1592static int idecd_open(struct block_device *bdev, fmode_t mode)
1593{ 1593{
1594 struct cdrom_info *info = ide_cd_get(bdev->bd_disk); 1594 struct cdrom_info *info;
1595 int rc = -ENOMEM; 1595 int rc = -ENXIO;
1596 1596
1597 lock_kernel();
1598 info = ide_cd_get(bdev->bd_disk);
1597 if (!info) 1599 if (!info)
1598 return -ENXIO; 1600 goto out;
1599 1601
1600 rc = cdrom_open(&info->devinfo, bdev, mode); 1602 rc = cdrom_open(&info->devinfo, bdev, mode);
1601
1602 if (rc < 0) 1603 if (rc < 0)
1603 ide_cd_put(info); 1604 ide_cd_put(info);
1604 1605out:
1606 unlock_kernel();
1605 return rc; 1607 return rc;
1606} 1608}
1607 1609
@@ -1609,9 +1611,11 @@ static int idecd_release(struct gendisk *disk, fmode_t mode)
1609{ 1611{
1610 struct cdrom_info *info = ide_drv_g(disk, cdrom_info); 1612 struct cdrom_info *info = ide_drv_g(disk, cdrom_info);
1611 1613
1614 lock_kernel();
1612 cdrom_release(&info->devinfo, mode); 1615 cdrom_release(&info->devinfo, mode);
1613 1616
1614 ide_cd_put(info); 1617 ide_cd_put(info);
1618 unlock_kernel();
1615 1619
1616 return 0; 1620 return 0;
1617} 1621}