dm: core: Check uclass_get() return value when dumping

Update dm_dump_drivers() to use the return value from uclass_get() to
check the validity of uc. This is equivalent and should be more attractive
to Coverity.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Coverity (CID: 316601)
This commit is contained in:
Simon Glass
2021-05-13 19:39:24 -06:00
committed by Tom Rini
parent 37e79ee0e8
commit 9dec2c1f03

View File

@@ -130,18 +130,19 @@ void dm_dump_drivers(void)
struct driver *entry;
struct udevice *udev;
struct uclass *uc;
int ret;
int i;
puts("Driver uid uclass Devices\n");
puts("----------------------------------------------------------\n");
for (entry = d; entry < d + n_ents; entry++) {
uclass_get(entry->id, &uc);
ret = uclass_get(entry->id, &uc);
printf("%-25.25s %-3.3d %-20.20s ", entry->name, entry->id,
uc ? uc->uc_drv->name : "<no uclass>");
!ret ? uc->uc_drv->name : "<no uclass>");
if (!uc) {
if (ret) {
puts("\n");
continue;
}