From 9dec2c1f03922977725d14ebc89fdc05b1f32511 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Thu, 13 May 2021 19:39:24 -0600 Subject: [PATCH] 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 Reported-by: Coverity (CID: 316601) --- drivers/core/dump.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/core/dump.c b/drivers/core/dump.c index f8afea30a9..f2f9cacc56 100644 --- a/drivers/core/dump.c +++ b/drivers/core/dump.c @@ -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 : ""); + !ret ? uc->uc_drv->name : ""); - if (!uc) { + if (ret) { puts("\n"); continue; } -- 2.39.5