diff options
-rw-r--r-- | drivers/block/pktcdvd.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c index c0233efabeba..51b7a5c5b77a 100644 --- a/drivers/block/pktcdvd.c +++ b/drivers/block/pktcdvd.c | |||
@@ -1955,9 +1955,12 @@ static int pkt_open_dev(struct pktcdvd_device *pd, int write) | |||
1955 | if ((ret = blkdev_get(pd->bdev, FMODE_READ, O_RDONLY))) | 1955 | if ((ret = blkdev_get(pd->bdev, FMODE_READ, O_RDONLY))) |
1956 | goto out; | 1956 | goto out; |
1957 | 1957 | ||
1958 | if ((ret = bd_claim(pd->bdev, pd))) | ||
1959 | goto out_putdev; | ||
1960 | |||
1958 | if ((ret = pkt_get_last_written(pd, &lba))) { | 1961 | if ((ret = pkt_get_last_written(pd, &lba))) { |
1959 | printk("pktcdvd: pkt_get_last_written failed\n"); | 1962 | printk("pktcdvd: pkt_get_last_written failed\n"); |
1960 | goto out_putdev; | 1963 | goto out_unclaim; |
1961 | } | 1964 | } |
1962 | 1965 | ||
1963 | set_capacity(pd->disk, lba << 2); | 1966 | set_capacity(pd->disk, lba << 2); |
@@ -1967,7 +1970,7 @@ static int pkt_open_dev(struct pktcdvd_device *pd, int write) | |||
1967 | q = bdev_get_queue(pd->bdev); | 1970 | q = bdev_get_queue(pd->bdev); |
1968 | if (write) { | 1971 | if (write) { |
1969 | if ((ret = pkt_open_write(pd))) | 1972 | if ((ret = pkt_open_write(pd))) |
1970 | goto out_putdev; | 1973 | goto out_unclaim; |
1971 | /* | 1974 | /* |
1972 | * Some CDRW drives can not handle writes larger than one packet, | 1975 | * Some CDRW drives can not handle writes larger than one packet, |
1973 | * even if the size is a multiple of the packet size. | 1976 | * even if the size is a multiple of the packet size. |
@@ -1982,13 +1985,15 @@ static int pkt_open_dev(struct pktcdvd_device *pd, int write) | |||
1982 | } | 1985 | } |
1983 | 1986 | ||
1984 | if ((ret = pkt_set_segment_merging(pd, q))) | 1987 | if ((ret = pkt_set_segment_merging(pd, q))) |
1985 | goto out_putdev; | 1988 | goto out_unclaim; |
1986 | 1989 | ||
1987 | if (write) | 1990 | if (write) |
1988 | printk("pktcdvd: %lukB available on disc\n", lba << 1); | 1991 | printk("pktcdvd: %lukB available on disc\n", lba << 1); |
1989 | 1992 | ||
1990 | return 0; | 1993 | return 0; |
1991 | 1994 | ||
1995 | out_unclaim: | ||
1996 | bd_release(pd->bdev); | ||
1992 | out_putdev: | 1997 | out_putdev: |
1993 | blkdev_put(pd->bdev); | 1998 | blkdev_put(pd->bdev); |
1994 | out: | 1999 | out: |
@@ -2007,6 +2012,7 @@ static void pkt_release_dev(struct pktcdvd_device *pd, int flush) | |||
2007 | pkt_lock_door(pd, 0); | 2012 | pkt_lock_door(pd, 0); |
2008 | 2013 | ||
2009 | pkt_set_speed(pd, MAX_SPEED, MAX_SPEED); | 2014 | pkt_set_speed(pd, MAX_SPEED, MAX_SPEED); |
2015 | bd_release(pd->bdev); | ||
2010 | blkdev_put(pd->bdev); | 2016 | blkdev_put(pd->bdev); |
2011 | } | 2017 | } |
2012 | 2018 | ||