diff options
-rw-r--r-- | drivers/block/loop.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/block/loop.c b/drivers/block/loop.c index cbf7052d1dd5..c59a672a3de0 100644 --- a/drivers/block/loop.c +++ b/drivers/block/loop.c | |||
@@ -1658,7 +1658,7 @@ static struct kobject *loop_probe(dev_t dev, int *part, void *data) | |||
1658 | struct kobject *kobj; | 1658 | struct kobject *kobj; |
1659 | 1659 | ||
1660 | mutex_lock(&loop_devices_mutex); | 1660 | mutex_lock(&loop_devices_mutex); |
1661 | lo = loop_init_one(dev & MINORMASK); | 1661 | lo = loop_init_one(MINOR(dev) >> part_shift); |
1662 | kobj = lo ? get_disk(lo->lo_disk) : ERR_PTR(-ENOMEM); | 1662 | kobj = lo ? get_disk(lo->lo_disk) : ERR_PTR(-ENOMEM); |
1663 | mutex_unlock(&loop_devices_mutex); | 1663 | mutex_unlock(&loop_devices_mutex); |
1664 | 1664 | ||
@@ -1699,10 +1699,10 @@ static int __init loop_init(void) | |||
1699 | 1699 | ||
1700 | if (max_loop) { | 1700 | if (max_loop) { |
1701 | nr = max_loop; | 1701 | nr = max_loop; |
1702 | range = max_loop; | 1702 | range = max_loop << part_shift; |
1703 | } else { | 1703 | } else { |
1704 | nr = 8; | 1704 | nr = 8; |
1705 | range = 1UL << (MINORBITS - part_shift); | 1705 | range = 1UL << MINORBITS; |
1706 | } | 1706 | } |
1707 | 1707 | ||
1708 | if (register_blkdev(LOOP_MAJOR, "loop")) | 1708 | if (register_blkdev(LOOP_MAJOR, "loop")) |
@@ -1741,7 +1741,7 @@ static void __exit loop_exit(void) | |||
1741 | unsigned long range; | 1741 | unsigned long range; |
1742 | struct loop_device *lo, *next; | 1742 | struct loop_device *lo, *next; |
1743 | 1743 | ||
1744 | range = max_loop ? max_loop : 1UL << (MINORBITS - part_shift); | 1744 | range = max_loop ? max_loop << part_shift : 1UL << MINORBITS; |
1745 | 1745 | ||
1746 | list_for_each_entry_safe(lo, next, &loop_devices, lo_list) | 1746 | list_for_each_entry_safe(lo, next, &loop_devices, lo_list) |
1747 | loop_del_one(lo); | 1747 | loop_del_one(lo); |