Skip to content

Commit 776b54e

Browse files
Christoph Hellwigaxboe
authored andcommitted
mtd_blkdevs: don't scan partitions for plain mtdblock
mtdblock / mtdblock_ro set part_bits to 0 and thus nevever scanned partitions. Restore that behavior by setting the GENHD_FL_NO_PART flag. Fixes: 1ebe2e5 ("block: remove GENHD_FL_EXT_DEVT") Reported-by: Geert Uytterhoeven <[email protected]> Signed-off-by: Christoph Hellwig <[email protected]> Tested-by: Geert Uytterhoeven <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent e3f9387 commit 776b54e

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

drivers/mtd/mtd_blkdevs.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ int add_mtd_blktrans_dev(struct mtd_blktrans_dev *new)
346346
gd->minors = 1 << tr->part_bits;
347347
gd->fops = &mtd_block_ops;
348348

349-
if (tr->part_bits)
349+
if (tr->part_bits) {
350350
if (new->devnum < 26)
351351
snprintf(gd->disk_name, sizeof(gd->disk_name),
352352
"%s%c", tr->name, 'a' + new->devnum);
@@ -355,9 +355,11 @@ int add_mtd_blktrans_dev(struct mtd_blktrans_dev *new)
355355
"%s%c%c", tr->name,
356356
'a' - 1 + new->devnum / 26,
357357
'a' + new->devnum % 26);
358-
else
358+
} else {
359359
snprintf(gd->disk_name, sizeof(gd->disk_name),
360360
"%s%d", tr->name, new->devnum);
361+
gd->flags |= GENHD_FL_NO_PART;
362+
}
361363

362364
set_capacity(gd, ((u64)new->size * tr->blksize) >> 9);
363365

0 commit comments

Comments
 (0)