mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-13 23:34:05 +08:00
dasd: cleanup dasd_scan_partitions
Use blkdev_get_by_dev instead of bdget_disk + blkdev_get. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Stefan Haberland <sth@linux.ibm.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
parent
5a56ad7882
commit
841ab72cb5
@ -101,18 +101,11 @@ int dasd_scan_partitions(struct dasd_block *block)
|
||||
struct block_device *bdev;
|
||||
int rc;
|
||||
|
||||
bdev = bdget_disk(block->gdp, 0);
|
||||
if (!bdev) {
|
||||
DBF_DEV_EVENT(DBF_ERR, block->base, "%s",
|
||||
"scan partitions error, bdget returned NULL");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
rc = blkdev_get(bdev, FMODE_READ, NULL);
|
||||
if (rc < 0) {
|
||||
bdev = blkdev_get_by_dev(disk_devt(block->gdp), FMODE_READ, NULL);
|
||||
if (IS_ERR(bdev)) {
|
||||
DBF_DEV_EVENT(DBF_ERR, block->base,
|
||||
"scan partitions error, blkdev_get returned %d",
|
||||
rc);
|
||||
"scan partitions error, blkdev_get returned %ld",
|
||||
PTR_ERR(bdev));
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user