mtd_blk_probe() never initializes bdesc->lba, so every MTD block device reports a block count of zero regardless of the underlying MTD device's actual size. This makes MTD block devices unusable for partition table (GPT/MBR) scanning, since partition code relies on lba to know the device's extent.
Set lba from the MTD device's size and the block descriptor's blksz, mirroring how other block drivers populate this field during probe. Signed-off-by: Vandhiadevan Karunamoorthy <[email protected]> --- drivers/mtd/mtdblock.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/mtd/mtdblock.c b/drivers/mtd/mtdblock.c index 66a79b8c56a..27ba0830460 100644 --- a/drivers/mtd/mtdblock.c +++ b/drivers/mtd/mtdblock.c @@ -211,6 +211,8 @@ static int mtd_blk_probe(struct udevice *dev) pr_warn("MTD device '%s' is NAND, please use UBI devices instead\n", mtd->name); + bdesc->lba = lldiv(mtd->size, bdesc->blksz); + return 0; } -- 2.34.1
