From 36af37b9367677f16b09c7d57fb84674979a7a2b Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sat, 3 Oct 2020 11:31:31 -0600 Subject: 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 --- drivers/core/device.c | 1 + 1 file changed, 1 insertion(+) (limited to 'drivers/core') diff --git a/drivers/core/device.c b/drivers/core/device.c index e90d70101c2..746c619cd96 100644 --- a/drivers/core/device.c +++ b/drivers/core/device.c @@ -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); } -- cgit v1.2.3