imagemap_test_mtd_blk() takes the first block device of type PART_TYPE_MTD and works on it as the SPI-NOR of the test device tree. Every MTD device binds an mtd_blk, so a further MTD device in the device tree can hold that place, and the test then looks for the "nor-fit" partition on a device that does not have it.
Walk the block devices for the one that carries the partition the test needs, probing each candidate on the way, which is what the single probe after the loop did for the first device. Signed-off-by: Heiko Schocher <[email protected]> --- Changes in v3: - New patch. Problem found on CI run: https://dev.azure.com/hs0298/hs/_build/results?buildId=223&view=results The next patch gives the test device tree two MTD devices of its own, one of which took the first mtd_blk away from this test test/boot/imagemap.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/test/boot/imagemap.c b/test/boot/imagemap.c index de00a174470..717d4d5fa71 100644 --- a/test/boot/imagemap.c +++ b/test/boot/imagemap.c @@ -539,17 +539,22 @@ static int imagemap_test_mtd_blk(struct unit_test_state *uts) */ mtd_probe_devices(); - /* Find the bound mtd_blk (a PART_TYPE_MTD block device) */ + /* + * Every MTD device of the test device tree binds an mtd_blk, so the + * partition this test needs is what tells the SPI-NOR apart. + */ for (uclass_find_first_device(UCLASS_BLK, &dev); dev; uclass_find_next_device(&dev)) { desc = dev_get_uclass_plat(dev); - if (desc->part_type == PART_TYPE_MTD) { + if (desc->part_type != PART_TYPE_MTD || device_probe(dev)) + continue; + + if (part_get_info_by_name(desc, "nor-fit", &info) >= 1) { blk = dev; break; } } ut_assertnonnull(blk); - ut_assertok(device_probe(blk)); desc = dev_get_uclass_plat(blk); /* Write a known pattern into the "nor-fit" partition */ -- 2.55.0
