dm: test: Add a check that all devices have a dev value

With of-platdata, the driver_info struct is updated with the device
pointer when it is bound. This makes it easy for a device to be found by
its driver info with the device_get_by_driver_info() function.

Add a test that all devices (except the root device) have such an entry.
Fix a bug that the function does not set *devp to NULL on failure, which
the documentation asserts.

Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Simon Glass
2020-10-03 11:31:31 -06:00
parent b325248c93
commit 36af37b936
2 changed files with 82 additions and 0 deletions

View File

@@ -767,6 +767,7 @@ int device_get_by_driver_info(const struct driver_info *info,
struct udevice *dev;
dev = info->dev;
*devp = NULL;
return device_get_device_tail(dev, dev ? 0 : -ENOENT, devp);
}