mtd: mtd_blk: fix get: mtd error if device is nand

Change-Id: I1cebba63cbabefa87fd67d98a4d93e151604626d
Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
This commit is contained in:
Jason Zhu 2019-10-30 16:37:54 +08:00
parent 4bac908b8b
commit f3ba630b34
1 changed files with 2 additions and 0 deletions

View File

@ -184,6 +184,8 @@ static int mtd_blk_probe(struct udevice *udev)
memcpy(desc->product, mtd->name, strlen(mtd->name)); memcpy(desc->product, mtd->name, strlen(mtd->name));
memcpy(desc->revision, "V1.00", sizeof("V1.00")); memcpy(desc->revision, "V1.00", sizeof("V1.00"));
if (mtd->type == MTD_NANDFLASH) { if (mtd->type == MTD_NANDFLASH) {
if (desc->devnum == BLK_MTD_NAND)
mtd = dev_get_priv(udev->parent);
/* /*
* Find the first useful block in the end, * Find the first useful block in the end,
* and it is the end lba of the nand storage. * and it is the end lba of the nand storage.