diff options
Diffstat (limited to 'block/genhd.c')
-rw-r--r-- | block/genhd.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/block/genhd.c b/block/genhd.c index 397960cf26af..e1eadcc9546a 100644 --- a/block/genhd.c +++ b/block/genhd.c | |||
@@ -1087,6 +1087,14 @@ dev_t blk_lookup_devt(const char *name, int partno) | |||
1087 | if (strcmp(dev_name(dev), name)) | 1087 | if (strcmp(dev_name(dev), name)) |
1088 | continue; | 1088 | continue; |
1089 | 1089 | ||
1090 | if (partno < disk->minors) { | ||
1091 | /* We need to return the right devno, even | ||
1092 | * if the partition doesn't exist yet. | ||
1093 | */ | ||
1094 | devt = MKDEV(MAJOR(dev->devt), | ||
1095 | MINOR(dev->devt) + partno); | ||
1096 | break; | ||
1097 | } | ||
1090 | part = disk_get_part(disk, partno); | 1098 | part = disk_get_part(disk, partno); |
1091 | if (part) { | 1099 | if (part) { |
1092 | devt = part_devt(part); | 1100 | devt = part_devt(part); |