device_find_block_device returns 0 on success, so the way the else if clause is now, only if there is a block device, the code falls through. If there is none, a 0 is returned, but devpath is not populated breaking the contract of the function. Just drop the branch for now and add back it later in a way that works.
Signed-off-by: Ahmad Fatoum <a.fat...@pengutronix.de> --- src/libdt.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/libdt.c b/src/libdt.c index 580b0b0ba769..12d692d2b2cf 100644 --- a/src/libdt.c +++ b/src/libdt.c @@ -2519,13 +2519,10 @@ int of_get_devicepath(struct device_node *partition_node, char **devpath, off_t */ dev = of_find_device_by_node_path(partition_node->full_name); if (dev) { - if (udev_device_is_eeprom(dev)) { + if (udev_device_is_eeprom(dev)) return udev_parse_eeprom(dev, devpath); - } else if (!udev_parse_mtd(dev, devpath, size)) { + if (!udev_parse_mtd(dev, devpath, size)) return 0; - } else if (device_find_block_device(dev, devpath)) { - return of_parse_partition(partition_node, offset, size); - } /* * If we found a device but couldn't classify it above, we fall -- 2.39.2