[PATCH 02/14] block: switch register_disk to use blkdev_get_by_dev

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Use blkdev_get_by_dev instead of open coding it using bdget_disk +
blkdev_get.

Signed-off-by: Christoph Hellwig <hch@xxxxxx>
---
 block/genhd.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/block/genhd.c b/block/genhd.c
index 7b56203c90a303..f778716fac6cde 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -732,10 +732,9 @@ static void register_disk(struct device *parent, struct gendisk *disk,
 		goto exit;
 
 	set_bit(GD_NEED_PART_SCAN, &disk->state);
-	err = blkdev_get(bdev, FMODE_READ, NULL);
-	if (err < 0)
-		goto exit;
-	blkdev_put(bdev, FMODE_READ);
+	bdev = blkdev_get_by_dev(disk_devt(disk), FMODE_READ, NULL);
+	if (!IS_ERR(bdev))
+		blkdev_put(bdev, FMODE_READ);
 
 exit:
 	/* announce disk after possible partitions are created */
-- 
2.28.0




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux