From 8676ae36ae4617b20b5cc49972c54c63c7b27bb3 Mon Sep 17 00:00:00 2001 From: Michal Suchanek Date: Wed, 12 Oct 2022 21:57:58 +0200 Subject: cmd: List all uclass devices regardless of probe error There are a few commands that iterate uclass with uclass_first_device/uclass_next_device or the _err variant. Use the _check class iterator variant to get devices that fail to probe as well, and print the status. Signed-off-by: Michal Suchanek Reviewed-by: Simon Glass --- cmd/pmic.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'cmd/pmic.c') diff --git a/cmd/pmic.c b/cmd/pmic.c index 0cb44d0740..49a405fa29 100644 --- a/cmd/pmic.c +++ b/cmd/pmic.c @@ -51,25 +51,26 @@ static int do_list(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) { struct udevice *dev; - int ret; + int ret, err = 0; printf("| %-*.*s| %-*.*s| %s @ %s\n", LIMIT_DEV, LIMIT_DEV, "Name", LIMIT_PARENT, LIMIT_PARENT, "Parent name", "Parent uclass", "seq"); - for (ret = uclass_first_device(UCLASS_PMIC, &dev); dev; - ret = uclass_next_device(&dev)) { + for (ret = uclass_first_device_check(UCLASS_PMIC, &dev); dev; + ret = uclass_next_device_check(&dev)) { if (ret) - continue; + err = ret; - printf("| %-*.*s| %-*.*s| %s @ %d\n", + printf("| %-*.*s| %-*.*s| %s @ %d | status: %i\n", LIMIT_DEV, LIMIT_DEV, dev->name, LIMIT_PARENT, LIMIT_PARENT, dev->parent->name, - dev_get_uclass_name(dev->parent), dev_seq(dev->parent)); + dev_get_uclass_name(dev->parent), dev_seq(dev->parent), + ret); } - if (ret) + if (err) return CMD_RET_FAILURE; return CMD_RET_SUCCESS; -- cgit v1.2.3